diff options
author | Thomas Hindoe Paaboel Andersen <phomes@gmail.com> | 2013-02-12 21:47:36 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-02-13 00:56:13 +0100 |
commit | 641906e9366891e0ad3e6e38b7396a427678c4cf (patch) | |
tree | 47f90e01b79c50ab0839f0a0a10a8fae81dd9a25 /src/shared/env-util.c | |
parent | 8d6167101696a28b7ac61b48fd2c1920564c4e90 (diff) |
use strneq instead of strncmp
Diffstat (limited to 'src/shared/env-util.c')
-rw-r--r-- | src/shared/env-util.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/shared/env-util.c b/src/shared/env-util.c index 9a833d22e4..0f1ac9294b 100644 --- a/src/shared/env-util.c +++ b/src/shared/env-util.c @@ -128,7 +128,7 @@ bool strv_env_is_valid(char **e) { /* Check if there are duplicate assginments */ k = strcspn(*p, "="); STRV_FOREACH(q, p + 1) - if (strncmp(*p, *q, k) == 0 && (*q)[k] == '=') + if (strneq(*p, *q, k) && (*q)[k] == '=') return false; } @@ -171,7 +171,7 @@ static int env_append(char **r, char ***k, char **a) { n++; for (j = r; j < *k; j++) - if (strncmp(*j, *a, n) == 0) + if (strneq(*j, *a, n)) break; if (j >= *k) @@ -247,7 +247,7 @@ static bool env_match(const char *t, const char *pattern) { if (!strchr(pattern, '=')) { size_t l = strlen(pattern); - return strncmp(t, pattern, l) == 0 && t[l] == '='; + return strneq(t, pattern, l) && t[l] == '='; } return false; @@ -363,7 +363,7 @@ char *strv_env_get_n(char **l, const char *name, size_t k) { return NULL; STRV_FOREACH(i, l) - if (strncmp(*i, name, k) == 0 && + if (strneq(*i, name, k) && (*i)[k] == '=') return *i + k + 1; @@ -391,7 +391,7 @@ char **strv_env_clean(char **e) { n = strcspn(*p, "="); STRV_FOREACH(q, p + 1) - if (strncmp(*p, *q, n) == 0 && (*q)[n] == '=') { + if (strneq(*p, *q, n) && (*q)[n] == '=') { duplicate = true; break; } |