Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1641198

[PATCH 1/2] kstrtox: delete end-of-string test

From Alexey Dobriyan <adobriyan@gmail.com>
Newsgroups linux.kernel
Subject [PATCH 1/2] kstrtox: delete end-of-string test
Date 2017-05-14 21:40 +0200
Message-ID <tH7wZ-5PJ-3@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 lib/kstrtox.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/lib/kstrtox.c
+++ b/lib/kstrtox.c
@@ -51,7 +51,7 @@ unsigned int _parse_integer(const char *s, unsigned int base, unsigned long long
 
 	res = 0;
 	rv = 0;
-	while (*s) {
+	while (1) {
 		unsigned int val;
 
 		if ('0' <= *s && *s <= '9')

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 1/2] kstrtox: delete end-of-string test Alexey Dobriyan <adobriyan@gmail.com> - 2017-05-14 21:40 +0200

csiph-web