diff options
author | Lennart Poettering <lennart@poettering.net> | 2017-11-29 12:40:22 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2017-11-29 12:41:08 +0100 |
commit | 7b943bb7e3e2fad3481c7191edbfaeef0680b196 (patch) | |
tree | cdbc6c8016fef04137c80128eb92f47a057915be /src/core/dbus-execute.c | |
parent | bus-unit-util: properly serialize EnvironmentFile= empty assignment (diff) | |
download | systemd-7b943bb7e3e2fad3481c7191edbfaeef0680b196.tar.xz systemd-7b943bb7e3e2fad3481c7191edbfaeef0680b196.zip |
tree-wide: use strv_isempty() instead of strv_length() == 0
It's a lot faster in many cases, since it's O(1) rather than O(n).
Diffstat (limited to 'src/core/dbus-execute.c')
-rw-r--r-- | src/core/dbus-execute.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c index 412be2a6c4..14fb46ec59 100644 --- a/src/core/dbus-execute.c +++ b/src/core/dbus-execute.c @@ -1108,7 +1108,7 @@ int bus_exec_context_set_transient_property( } if (!UNIT_WRITE_FLAGS_NOOP(flags)) { - if (strv_length(l) == 0) { + if (strv_isempty(l)) { c->supplementary_groups = strv_free(c->supplementary_groups); unit_write_settingf(u, flags, name, "%s=", name); } else { @@ -1360,7 +1360,7 @@ int bus_exec_context_set_transient_property( if (!UNIT_WRITE_FLAGS_NOOP(flags)) { _cleanup_free_ char *joined = NULL; - if (strv_length(l) == 0) { + if (strv_isempty(l)) { c->syscall_whitelist = false; c->syscall_filter = hashmap_free(c->syscall_filter); } else { @@ -1433,7 +1433,7 @@ int bus_exec_context_set_transient_property( if (!UNIT_WRITE_FLAGS_NOOP(flags)) { _cleanup_free_ char *joined = NULL; - if (strv_length(l) == 0) + if (strv_isempty(l)) c->syscall_archs = set_free(c->syscall_archs); else { char **s; @@ -1506,7 +1506,7 @@ int bus_exec_context_set_transient_property( if (!UNIT_WRITE_FLAGS_NOOP(flags)) { _cleanup_free_ char *joined = NULL; - if (strv_length(l) == 0) { + if (strv_isempty(l)) { c->address_families_whitelist = false; c->address_families = set_free(c->address_families); } else { @@ -2073,7 +2073,7 @@ int bus_exec_context_set_transient_property( return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid environment block."); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { - if (strv_length(l) == 0) { + if (strv_isempty(l)) { c->environment = strv_free(c->environment); unit_write_setting(u, flags, name, "Environment="); } else { @@ -2109,7 +2109,7 @@ int bus_exec_context_set_transient_property( return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid UnsetEnvironment= list."); if (!UNIT_WRITE_FLAGS_NOOP(flags)) { - if (strv_length(l) == 0) { + if (strv_isempty(l)) { c->unset_environment = strv_free(c->unset_environment); unit_write_setting(u, flags, name, "UnsetEnvironment="); } else { @@ -2316,7 +2316,7 @@ int bus_exec_context_set_transient_property( else /* "InaccessiblePaths" */ dirs = &c->inaccessible_paths; - if (strv_length(l) == 0) { + if (strv_isempty(l)) { *dirs = strv_free(*dirs); unit_write_settingf(u, flags, name, "%s=", name); } else { |