Skip to contentSkip to conversation

lib/kstrtox.c: delete end-of-string test

PATCH New [email protected] 1 participant 1 message Jul 10, 2017 Library code

lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 88/115 lib/kstrtox.c: delete end-of-string test

From: Alexey Dobriyan <[email protected]>
Subject: lib/kstrtox.c: delete end-of-string test

Standard "while (*s)" test is unnecessary because NUL won't pass valid-digit test anyway. Save one branch per parsed character.

---

 lib/kstrtox.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/kstrtox.c renamed from lib/kstrtox.c~kstrtox-delete-end-of-string-test +1 -1
diff -puN lib/kstrtox.c~kstrtox-delete-end-of-string-test lib/kstrtox.c
@@ -51,7 +51,7 @@ unsigned int _parse_integer(const char *
 
 	res = 0;
 	rv = 0;
-	while (*s) {
+	while (1) {
 		unsigned int val;
 
 		if ('0' <= *s && *s <= '9')

_