From 96b23440c1b74cd95022e3ebb08a60fedb04f3b9 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 24 Jul 2021 09:03:32 -0600 Subject: 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 --- lib/strto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/strto.c') diff --git a/lib/strto.c b/lib/strto.c index 72903a57c07..53886722138 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; -- cgit v1.2.3