summaryrefslogtreecommitdiff
path: root/lib/strto.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-07-24 09:03:32 -0600
committerTom Rini <trini@konsulko.com>2021-08-02 13:32:14 -0400
commit96b23440c1b74cd95022e3ebb08a60fedb04f3b9 (patch)
tree468fe008d651886455b680de0376a01b7fdee160 /lib/strto.c
parent18546f2982bc2032276759530328725ec4561454 (diff)
downloadu-boot-96b23440c1b74cd95022e3ebb08a60fedb04f3b9.tar.gz
u-boot-96b23440c1b74cd95022e3ebb08a60fedb04f3b9.tar.bz2
u-boot-96b23440c1b74cd95022e3ebb08a60fedb04f3b9.zip
lib: Drop unnecessary check for hex digit
If we see 0x then we can assume this is the start of a hex value. It does not seem necessary to check for a hex digit after that since it will happen when parsing the value anyway. Drop this check to simplify the code and reduce size. Add a few more test cases for when a 0x prefix is used. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'lib/strto.c')
-rw-r--r--lib/strto.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/strto.c b/lib/strto.c
index 72903a57c0..5388672213 100644
--- a/lib/strto.c
+++ b/lib/strto.c
@@ -18,7 +18,7 @@ static const char *_parse_integer_fixup_radix(const char *s, unsigned int *base)
{
if (*base == 0) {
if (s[0] == '0') {
- if (tolower(s[1]) == 'x' && isxdigit(s[2]))
+ if (tolower(s[1]) == 'x')
*base = 16;
else
*base = 8;