summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-04-11 08:37:08 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-04-11 08:37:11 +0200
commitb612a54cec72fe5bd6ce22623e157c1787e167f1 (patch)
tree5d0cf43bccc19a2f299b5f4efce27ed627283d11 /lib
parent00522e699290fd887e98e04fe2c005111a9b1914 (diff)
downloadbarebox-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.c9
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++;
}