From b1ea85dc08009fb3cbb649a88979b2979426b9d2 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 22 Mar 2019 12:14:09 +0100 Subject: [PATCH] dbus-execute: lets use exec_directory_type_from_string() to simplify things --- src/core/dbus-execute.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c index 0b28643e79..67cc48803c 100644 --- a/src/core/dbus-execute.c +++ b/src/core/dbus-execute.c @@ -2185,24 +2185,19 @@ int bus_exec_context_set_transient_property( } if (!UNIT_WRITE_FLAGS_NOOP(flags)) { - char ***dirs = NULL; ExecDirectoryType i; + ExecDirectory *d; - for (i = 0; i < _EXEC_DIRECTORY_TYPE_MAX; i++) - if (streq(name, exec_directory_type_to_string(i))) { - dirs = &c->directories[i].paths; - break; - } - - assert(dirs); + assert_se((i = exec_directory_type_from_string(name)) >= 0); + d = c->directories + i; if (strv_isempty(l)) { - *dirs = strv_free(*dirs); + d->paths = strv_free(d->paths); unit_write_settingf(u, flags, name, "%s=", name); } else { _cleanup_free_ char *joined = NULL; - r = strv_extend_strv(dirs, l, true); + r = strv_extend_strv(&d->paths, l, true); if (r < 0) return -ENOMEM; -- 2.25.1