[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <b8bf37780911020926p77ca30d1maa4384f21323adb@mail.gmail.com>
Date: Mon, 2 Nov 2009 15:26:55 -0200
From: André Goddard Rosa <andre.goddard@...il.com>
To: Frederic Weisbecker <fweisbec@...il.com>, laijs@...fujitsu.com,
mingo@...e.hu, davem@...emloft.net, akpm@...ux-foundation.org,
harvey.harrison@...il.com,
linux list <linux-kernel@...r.kernel.org>
Cc: me <andre.goddard@...il.com>
Subject: [PATCH v2 7/7] vsprintf: factor out skip_space code in a separate
function
>From 584d9bfc7c1d41b76a05655b4562b98fcbef6ee4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Goddard=20Rosa?= <andre.goddard@...il.com>
Date: Sun, 1 Nov 2009 14:09:06 -0200
Subject: [PATCH v2 7/7] vsprintf: factor out skip_space code in a
separate function
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
It decreases code size:
text data bss dec hex filename
15703 0 8 15711 3d5f lib/vsprintf.o-before
15527 0 8 15535 3caf lib/vsprintf.o-after
Signed-off-by: André Goddard Rosa <andre.goddard@...il.com>
---
lib/vsprintf.c | 19 +++++++++++--------
1 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 957e252..c3b19d7 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1745,6 +1745,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
@@ -1766,10 +1773,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 */
@@ -1839,8 +1844,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--)
@@ -1882,8 +1886,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.140.g5f809
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists