From 9b5db3415de11c0e86399dce44790cb0a11952b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Goddard=20Rosa?= Date: Mon, 14 Dec 2009 18:01:00 -0800 Subject: [PATCH] --- yaml --- r: 176370 b: refs/heads/master c: c5484d7c0a533de6198cb474097e33b174f9c565 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/lib/vsprintf.c | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index a4a5135eccc6..68cdc68cda12 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: d4be151b2180fbbc6729dfaa16280d150e3fab1f +refs/heads/master: c5484d7c0a533de6198cb474097e33b174f9c565 diff --git a/trunk/lib/vsprintf.c b/trunk/lib/vsprintf.c index f9532e09b608..a315138ece55 100644 --- a/trunk/lib/vsprintf.c +++ b/trunk/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 == '-')