summaryrefslogtreecommitdiff
path: root/src/systemctl/systemctl.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-03-04 09:20:51 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-03-04 10:04:50 -0500
commit6e18964d3a365567954fe10ddcfad74babdc427c (patch)
treea1e62c233e0cac0224623049e6fb98b8e450d0ac /src/systemctl/systemctl.c
parente062dec5ae1a443d47885537af85d328c83c67db (diff)
Introduce strv_consume which takes ownership
This mirrors set_consume and makes the common use a bit nicer.
Diffstat (limited to 'src/systemctl/systemctl.c')
-rw-r--r--src/systemctl/systemctl.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 869271628f..952d2f8358 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -2167,13 +2167,11 @@ static int expand_names(sd_bus *bus, char **names, const char* suffix, char ***r
return log_oom();
if (string_is_glob(t))
- r = strv_push(&globs, t);
+ r = strv_consume(&globs, t);
else
- r = strv_push(&mangled, t);
- if (r < 0) {
- free(t);
+ r = strv_consume(&mangled, t);
+ if (r < 0)
return log_oom();
- }
}
/* Query the manager only if any of the names are a glob, since
@@ -5346,10 +5344,8 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
if (!prop)
return log_oom();
- if (strv_push(&arg_properties, prop) < 0) {
- free(prop);
+ if (strv_consume(&arg_properties, prop) < 0)
return log_oom();
- }
}
}
@@ -5518,10 +5514,8 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
if (!s)
return log_oom();
- if (strv_push(&arg_states, s) < 0) {
- free(s);
+ if (strv_consume(&arg_states, s) < 0)
return log_oom();
- }
}
break;
}