diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-01-16 11:49:24 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-01-16 11:53:43 +0100 |
commit | b5ffbc55791612749ef36925a56e7d2d6fe5227b (patch) | |
tree | 6d0a83f45897258ae34025980aa0acc788c26bd5 /src/basic/parse-util.c | |
parent | locale-util: add freelocale() cleanup helper (diff) | |
download | systemd-b5ffbc55791612749ef36925a56e7d2d6fe5227b.tar.xz systemd-b5ffbc55791612749ef36925a56e7d2d6fe5227b.zip |
parse-util: coding style fix
Let's not rely on C's downgrade-to-bool feature to check for NUL bytes
Diffstat (limited to '')
-rw-r--r-- | src/basic/parse-util.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/basic/parse-util.c b/src/basic/parse-util.c index ab80c2b04b..14687b16a0 100644 --- a/src/basic/parse-util.c +++ b/src/basic/parse-util.c @@ -84,7 +84,7 @@ int parse_mode(const char *s, mode_t *ret) { l = strtol(s, &x, 8); if (errno > 0) return -errno; - if (!x || x == s || *x) + if (!x || x == s || *x != 0) return -EINVAL; if (l < 0 || l > 07777) return -ERANGE; @@ -392,7 +392,7 @@ int safe_atou(const char *s, unsigned *ret_u) { l = strtoul(s, &x, 0); if (errno > 0) return -errno; - if (!x || x == s || *x) + if (!x || x == s || *x != 0) return -EINVAL; if (s[0] == '-') return -ERANGE; @@ -414,7 +414,7 @@ int safe_atoi(const char *s, int *ret_i) { l = strtol(s, &x, 0); if (errno > 0) return -errno; - if (!x || x == s || *x) + if (!x || x == s || *x != 0) return -EINVAL; if ((long) (int) l != l) return -ERANGE; @@ -436,7 +436,7 @@ int safe_atollu(const char *s, long long unsigned *ret_llu) { l = strtoull(s, &x, 0); if (errno > 0) return -errno; - if (!x || x == s || *x) + if (!x || x == s || *x != 0) return -EINVAL; if (*s == '-') return -ERANGE; @@ -456,7 +456,7 @@ int safe_atolli(const char *s, long long int *ret_lli) { l = strtoll(s, &x, 0); if (errno > 0) return -errno; - if (!x || x == s || *x) + if (!x || x == s || *x != 0) return -EINVAL; *ret_lli = l; @@ -476,7 +476,7 @@ int safe_atou8(const char *s, uint8_t *ret) { l = strtoul(s, &x, 0); if (errno > 0) return -errno; - if (!x || x == s || *x) + if (!x || x == s || *x != 0) return -EINVAL; if (s[0] == '-') return -ERANGE; @@ -500,7 +500,7 @@ int safe_atou16(const char *s, uint16_t *ret) { l = strtoul(s, &x, 0); if (errno > 0) return -errno; - if (!x || x == s || *x) + if (!x || x == s || *x != 0) return -EINVAL; if (s[0] == '-') return -ERANGE; @@ -522,7 +522,7 @@ int safe_atoi16(const char *s, int16_t *ret) { l = strtol(s, &x, 0); if (errno > 0) return -errno; - if (!x || x == s || *x) + if (!x || x == s || *x != 0) return -EINVAL; if ((long) (int16_t) l != l) return -ERANGE; |