]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
lib/vsprintf.c: replace while with do-while in skip_atoi
authorRasmus Villemoes <linux@rasmusvillemoes.dk>
Thu, 12 Feb 2015 23:01:42 +0000 (15:01 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 13 Feb 2015 02:54:13 +0000 (18:54 -0800)
All callers of skip_atoi have already checked for the first character
being a digit.  In this case, gcc generates simpler code for a do
while-loop.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
lib/vsprintf.c

index cf12ba86205c096eea6543e3c2850e384ca139c1..602d2081e713c802406e35888b996f6aea05823a 100644 (file)
@@ -114,8 +114,9 @@ int skip_atoi(const char **s)
 {
        int i = 0;
 
-       while (isdigit(**s))
+       do {
                i = i*10 + *((*s)++) - '0';
+       } while (isdigit(**s));
 
        return i;
 }