From: Rasmus Villemoes Date: Thu, 12 Feb 2015 23:01:42 +0000 (-0800) Subject: lib/vsprintf.c: replace while with do-while in skip_atoi X-Git-Tag: v4.0-rc1~98^2~36 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=43e5b666cf25516b5c27cd10c47d287dc9d1f376;p=linux.git 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 Cc: Jiri Kosina Cc: Randy Dunlap Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/lib/vsprintf.c b/lib/vsprintf.c index cf12ba86205c..602d2081e713 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -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; }