diff options
author | Lennart Poettering <lennart@poettering.net> | 2017-02-10 15:17:18 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2017-02-10 15:17:18 +0100 |
commit | b9418b053aee15d1e8395dde89165fb89d9e6484 (patch) | |
tree | 5a126f9894d3f176794be9a4c9295b347c54f33f /src | |
parent | c49970743eb51ab27b4b021bc64412ac74af83af (diff) |
path-lookup: drop redundant strv_isempty() check
If the strv is empty, then strv_extend_strv_concat() is a NOP anyway,
and hence there is no reason to guard for this explicitly.
Diffstat (limited to 'src')
-rw-r--r-- | src/shared/path-lookup.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c index dcfbab7b83..7f0751d3a1 100644 --- a/src/shared/path-lookup.c +++ b/src/shared/path-lookup.c @@ -138,10 +138,10 @@ static char** user_dirs( NULL }; - const char *e; _cleanup_strv_free_ char **config_dirs = NULL, **data_dirs = NULL; _cleanup_free_ char *data_home = NULL; _cleanup_strv_free_ char **res = NULL; + const char *e; char **tmp; int r; @@ -188,9 +188,8 @@ static char** user_dirs( if (strv_extend(&res, generator_early) < 0) return NULL; - if (!strv_isempty(config_dirs)) - if (strv_extend_strv_concat(&res, config_dirs, "/systemd/user") < 0) - return NULL; + if (strv_extend_strv_concat(&res, config_dirs, "/systemd/user") < 0) + return NULL; if (strv_extend(&res, persistent_config) < 0) return NULL; @@ -207,9 +206,8 @@ static char** user_dirs( if (strv_extend(&res, data_home) < 0) return NULL; - if (!strv_isempty(data_dirs)) - if (strv_extend_strv_concat(&res, data_dirs, "/systemd/user") < 0) - return NULL; + if (strv_extend_strv_concat(&res, data_dirs, "/systemd/user") < 0) + return NULL; if (strv_extend_strv(&res, (char**) data_unit_paths, false) < 0) return NULL; @@ -222,6 +220,7 @@ static char** user_dirs( tmp = res; res = NULL; + return tmp; } |