diff options
author | Rasmus Villemoes <linux@rasmusvillemoes.dk> | 2015-02-12 18:01:42 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-12 21:54:13 -0500 |
commit | 43e5b666cf25516b5c27cd10c47d287dc9d1f376 (patch) | |
tree | 1347a5fca8c89e284e3548e9059a3e1f6aee1e84 /lib | |
parent | 2aa2f9e21e4eb25c720b2e7d80f8929638f6ad73 (diff) |
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>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/vsprintf.c | 3 |
1 files changed, 2 insertions, 1 deletions
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) | |||
114 | { | 114 | { |
115 | int i = 0; | 115 | int i = 0; |
116 | 116 | ||
117 | while (isdigit(**s)) | 117 | do { |
118 | i = i*10 + *((*s)++) - '0'; | 118 | i = i*10 + *((*s)++) - '0'; |
119 | } while (isdigit(**s)); | ||
119 | 120 | ||
120 | return i; | 121 | return i; |
121 | } | 122 | } |