diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-10-17 14:41:14 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-10-17 20:51:14 +0200 |
commit | 68ac147e8db4e6cd4813037b682729ea98c4a707 (patch) | |
tree | 10b5aced40987c849f727181d8ba2c869b23511c /src/basic/env-util.c | |
parent | ee01882f820e443ddc35dd1965b8ceb9ea48aadb (diff) | |
download | systemd-68ac147e8db4e6cd4813037b682729ea98c4a707.tar.gz |
env-util: use strv_contains() where appropriate
Diffstat (limited to 'src/basic/env-util.c')
-rw-r--r-- | src/basic/env-util.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/basic/env-util.c b/src/basic/env-util.c index 3b8130b03e..c7c9a7dbe8 100644 --- a/src/basic/env-util.c +++ b/src/basic/env-util.c @@ -125,30 +125,28 @@ bool strv_env_is_valid(char **e) { } bool strv_env_name_is_valid(char **l) { - char **p, **q; + char **p; STRV_FOREACH(p, l) { if (!env_name_is_valid(*p)) return false; - STRV_FOREACH(q, p + 1) - if (streq(*p, *q)) - return false; + if (strv_contains(p + 1, *p)) + return false; } return true; } bool strv_env_name_or_assignment_is_valid(char **l) { - char **p, **q; + char **p; STRV_FOREACH(p, l) { if (!env_assignment_is_valid(*p) && !env_name_is_valid(*p)) return false; - STRV_FOREACH(q, p + 1) - if (streq(*p, *q)) - return false; + if (strv_contains(p + 1, *p)) + return false; } return true; |