diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2017-04-11 08:37:08 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2017-04-11 08:37:11 +0200 |
commit | b612a54cec72fe5bd6ce22623e157c1787e167f1 (patch) | |
tree | 5d0cf43bccc19a2f299b5f4efce27ed627283d11 /lib | |
parent | 00522e699290fd887e98e04fe2c005111a9b1914 (diff) | |
download | barebox-b612a54cec72fe5bd6ce22623e157c1787e167f1.tar.gz barebox-b612a54cec72fe5bd6ce22623e157c1787e167f1.tar.xz |
lib/strtox: remove unnecessary islower()
toupper() does the right thing, no need to test for islower()
beforehand, so
islower(*cp) ? toupper(*cp) : *cp
can be simplified to:
toupper(*cp)
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/strtox.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/strtox.c b/lib/strtox.c index 45aa06bacc..3bb6b0ef89 100644 --- a/lib/strtox.c +++ b/lib/strtox.c @@ -20,8 +20,8 @@ unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base) if (!base) base = 10; - while (isxdigit(*cp) && (value = isdigit(*cp) ? *cp - '0' : (islower(*cp) - ? toupper(*cp) : *cp) - 'A' + 10) < base) { + while (isxdigit(*cp) && (value = isdigit(*cp) ? + *cp - '0' : toupper(*cp) - 'A' + 10) < base) { result = result * base + value; cp++; } @@ -61,9 +61,8 @@ unsigned long long simple_strtoull(const char *cp, char **endp, unsigned int bas if (!base) base = 10; - while (isxdigit(*cp) && (value = isdigit(*cp) - ? *cp - '0' - : (islower(*cp) ? toupper(*cp) : *cp) - 'A' + 10) < base) { + while (isxdigit(*cp) && (value = isdigit(*cp) ? + *cp - '0' : toupper(*cp) - 'A' + 10) < base) { result = result * base + value; cp++; } |