diff options
author | Mark Johnston <markj@FreeBSD.org> | 2020-09-01 15:14:26 +0000 |
---|---|---|
committer | Mark Johnston <markj@FreeBSD.org> | 2020-09-01 15:14:26 +0000 |
commit | 8e1831db8e1354c3343f548e9df5db1f48d1f94c (patch) | |
tree | 292c30686d68c81247970c98275d56b5ab16cee0 | |
parent | 12fdadf20847f526473a7a129036dd4cbe4f8dd9 (diff) | |
download | pw-darwin-8e1831db8e1354c3343f548e9df5db1f48d1f94c.tar.gz pw-darwin-8e1831db8e1354c3343f548e9df5db1f48d1f94c.tar.zst pw-darwin-8e1831db8e1354c3343f548e9df5db1f48d1f94c.zip |
pw: Remove unnecessary errp checks.
The caller-supplied pointer is unconditionally dereferenced at the
beginning of the function, so there is no point in comparing it with
NULL thereafter.
Reported by: Coverity
MFC after: 1 week
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
-rw-r--r-- | pw/strtounum.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/pw/strtounum.c b/pw/strtounum.c index b2fefeb..ae578bd 100644 --- a/pw/strtounum.c +++ b/pw/strtounum.c @@ -44,28 +44,24 @@ strtounum(const char * __restrict np, uintmax_t minval, uintmax_t maxval, *errpp = NULL; if (minval > maxval) { errno = EINVAL; - if (errpp != NULL) - *errpp = "invalid"; + *errpp = "invalid"; return (0); } errno = 0; ret = strtoumax(np, &endp, 10); if (endp == np || *endp != '\0') { errno = EINVAL; - if (errpp != NULL) - *errpp = "invalid"; + *errpp = "invalid"; return (0); } if (ret < minval) { errno = ERANGE; - if (errpp != NULL) - *errpp = "too small"; + *errpp = "too small"; return (0); } if (errno == ERANGE || ret > maxval) { errno = ERANGE; - if (errpp != NULL) - *errpp = "too large"; + *errpp = "too large"; return (0); } return (ret); |