diff options
| author | Rasmus Villemoes <linux@rasmusvillemoes.dk> | 2015-02-12 15:01:42 -0800 |
|---|---|---|
| committer | Mister Oyster <oysterized@gmail.com> | 2017-04-11 10:59:21 +0200 |
| commit | 6e911dfa4448aa6fee30ab5dbb1c51b9a67b9e79 (patch) | |
| tree | 8904e1ff2f822c6a128bed5bc6076ed4b3933a98 | |
| parent | 2308bc5917bfbd95a1f203f173e8c570e160a9b7 (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>
| -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 c39116343..2738b25b9 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; } |
