summaryrefslogtreecommitdiff
path: root/src/systemctl
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-01-18 00:51:46 +0100
committerLennart Poettering <lennart@poettering.net>2013-01-18 00:51:48 +0100
commit540e7dbe9edeb7a309a89c51f22d27e3a7cd6390 (patch)
treeac783ee8db239784fd7fb3606713a349cf5429b4 /src/systemctl
parent82dde599ed2b8aa4877900d84e7a2ddc31ef8da2 (diff)
systemctl: we can make this faster and shorten it a bit with strv_extend()
Now that strv_extend() is not so slow anymore, we can make use of it, to shorten our code a bit.
Diffstat (limited to 'src/systemctl')
-rw-r--r--src/systemctl/systemctl.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 356854353c..852c4d1a86 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -760,7 +760,6 @@ static int list_dependencies_get_dependencies(DBusConnection *bus, const char *n
int r = 0;
char **ret = NULL;
- char **c;
assert(bus);
assert(name);
@@ -834,13 +833,13 @@ static int list_dependencies_get_dependencies(DBusConnection *bus, const char *n
assert(dbus_message_iter_get_arg_type(&sub4) == DBUS_TYPE_STRING);
dbus_message_iter_get_basic(&sub4, &s);
- c = strv_append(ret, s);
- if (c == NULL) {
- r = log_oom();
+
+ r = strv_extend(&ret, s);
+ if (r < 0) {
+ log_oom();
goto finish;
}
- strv_free(ret);
- ret = c;
+
dbus_message_iter_next(&sub4);
}
}