It decreases code size:
   text    data     bss     dec     hex filename
  15719       0       8   15727    3d6f lib/vsprintf.o-before
  15543       0       8   15551    3cbf lib/vsprintf.o-after

Signed-off-by: André Goddard Rosa <andre.godd...@gmail.com>
Acked-by: Frederic Weisbecker <fweis...@gmail.com>
---
 lib/vsprintf.c |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index f703fdf..566c947 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1736,6 +1736,13 @@ EXPORT_SYMBOL_GPL(bprintf);
 
 #endif /* CONFIG_BINARY_PRINTF */
 
+static noinline const char *skip_space(const char *str)
+{
+       while (isspace(*str))
+               ++str;
+       return str;
+}
+
 /**
  * vsscanf - Unformat a buffer into a list of arguments
  * @buf:       input buffer
@@ -1757,10 +1764,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 */
@@ -1830,8 +1835,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--)
@@ -1873,8 +1877,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 == '-')
-- 
1.6.5.2.153.g6e31f.dirty


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
User-mode-linux-user mailing list
User-mode-linux-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user

Reply via email to