chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
82dde59
)
systemctl: we can make this faster and shorten it a bit with strv_extend()
author
Lennart Poettering
<lennart@poettering.net>
Thu, 17 Jan 2013 23:51:46 +0000
(
00:51
+0100)
committer
Lennart Poettering
<lennart@poettering.net>
Thu, 17 Jan 2013 23:51:48 +0000
(
00:51
+0100)
Now that strv_extend() is not so slow anymore, we can make use of it, to
shorten our code a bit.
src/systemctl/systemctl.c
patch
|
blob
|
history
diff --git
a/src/systemctl/systemctl.c
b/src/systemctl/systemctl.c
index 356854353cdd1e1121fab87ba9e247c1bcdecda5..852c4d1a860d55f8c5d7da01b4525f17c5041719 100644
(file)
--- 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);
}
}