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.14-rc1~5954^2~36 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=43e5b666cf25516b5c27cd10c47d287dc9d1f376;p=platform%2Fkernel%2Flinux-rpi.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 cf12ba8..602d208 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; }