diff options
author | André Goddard Rosa <andre.goddard@gmail.com> | 2009-12-14 18:01:00 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-15 08:53:32 -0800 |
commit | c5484d7c0a533de6198cb474097e33b174f9c565 (patch) | |
tree | b546f0864d85724786157fff343723653d517865 /lib/vsprintf.c | |
parent | d4be151b2180fbbc6729dfaa16280d150e3fab1f (diff) | |
download | op-kernel-dev-c5484d7c0a533de6198cb474097e33b174f9c565.zip op-kernel-dev-c5484d7c0a533de6198cb474097e33b174f9c565.tar.gz |
vsprintf: factor out skip_space code in a separate function
When converting more caller sites, the inline decision will be left up to gcc.
It decreases code size:
text data bss dec hex filename
15710 0 8 15718 3d66 vsprintf.o (ex lib/lib.a-BEFORE)
15534 0 8 15542 3cb6 vsprintf.o (ex lib/lib.a-AFTER)
Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/vsprintf.c')
-rw-r--r-- | lib/vsprintf.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c index f9532e0..a315138 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -1786,6 +1786,13 @@ EXPORT_SYMBOL_GPL(bprintf); #endif /* CONFIG_BINARY_PRINTF */ +static noinline char *skip_space(const char *str) +{ + while (isspace(*str)) + ++str; + return (char *)str; +} + /** * vsscanf - Unformat a buffer into a list of arguments * @buf: input buffer @@ -1807,10 +1814,8 @@ int vsscanf(const char *buf, const char *fmt, va_list args) * white space, including none, in the input. */ if (isspace(*fmt)) { - while (isspace(*fmt)) - ++fmt; - while (isspace(*str)) - ++str; + fmt = skip_space(fmt); + str = skip_space(str); } /* anything that is not a conversion must match exactly */ @@ -1880,8 +1885,7 @@ int vsscanf(const char *buf, const char *fmt, va_list args) if (field_width == -1) field_width = INT_MAX; /* first, skip leading white space in buffer */ - while (isspace(*str)) - str++; + str = skip_space(str); /* now copy until next white space */ while (*str && !isspace(*str) && field_width--) @@ -1923,8 +1927,7 @@ int vsscanf(const char *buf, const char *fmt, va_list args) /* have some sort of integer conversion. * first, skip white space in buffer. */ - while (isspace(*str)) - str++; + str = skip_space(str); digit = *str; if (is_sign && digit == '-') |