Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

lib/vsprintf.c: replace while with do-while in skip_atoi

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>

authored by

Rasmus Villemoes and committed by
Linus Torvalds
43e5b666 2aa2f9e2

+2 -1
+2 -1
lib/vsprintf.c
··· 114 114 { 115 115 int i = 0; 116 116 117 - while (isdigit(**s)) 117 + do { 118 118 i = i*10 + *((*s)++) - '0'; 119 + } while (isdigit(**s)); 119 120 120 121 return i; 121 122 }