summaryrefslogtreecommitdiff
path: root/src/systemctl
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-01-18 00:29:47 +0100
committerLennart Poettering <lennart@poettering.net>2013-01-18 00:29:51 +0100
commite608b38a87fde7fd0b882c96ff235b26660ce074 (patch)
tree9b2697f4e4aabac0a74444ca4d2d49ed9ccd20f7 /src/systemctl
parent34048c8ca6446497afc69d4deb0c5ce42dffc010 (diff)
systemctl: we can use nulstr_contains() for this lookup
It's a bit easier to read...
Diffstat (limited to 'src/systemctl')
-rw-r--r--src/systemctl/systemctl.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 442179d340..003b70647e 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -745,13 +745,12 @@ static int list_dependencies_print(const char *name, int level, unsigned int bra
}
static int list_dependencies_get_dependencies(DBusConnection *bus, const char *name, char ***deps) {
- static const char * const dependencies[] = {
- "Requires",
- "RequiresOverridable",
- "Requisite",
- "RequisiteOverridable",
- "Wants"
- };
+ static const char dependencies[] =
+ "Requires\0"
+ "RequiresOverridable\0"
+ "Requisite\0"
+ "RequisiteOverridable\0"
+ "Wants\0";
_cleanup_free_ char *path;
const char *interface = "org.freedesktop.systemd1.Unit";
@@ -760,8 +759,6 @@ static int list_dependencies_get_dependencies(DBusConnection *bus, const char *n
DBusMessageIter iter, sub, sub2, sub3;
int r = 0;
- unsigned int i;
-
char **ret = NULL;
char **c;
@@ -822,15 +819,9 @@ static int list_dependencies_get_dependencies(DBusConnection *bus, const char *n
}
dbus_message_iter_recurse(&sub2, &sub3);
-
dbus_message_iter_next(&sub);
- for (i = 0; i < ELEMENTSOF(dependencies); i++)
- if (streq(dependencies[i], prop)) {
- break;
- }
-
- if (i == ELEMENTSOF(dependencies))
+ if (!nulstr_contains(dependencies, prop))
continue;
if (dbus_message_iter_get_arg_type(&sub3) == DBUS_TYPE_ARRAY) {