From: "André Goddard Rosa" <andre.goddard@gmail.com>
To: Martin Schwidefsky <schwidefsky@de.ibm.com>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
linux390@de.ibm.com, Michael Holzheu <holzheu@linux.vnet.ibm.com>,
Andrew Morton <akpm@linux-f>
Cc: "André Goddard Rosa" <andre.goddard@gmail.com>
Subject: [PATCH v4 07/12] vsprintf: factor out skip_space code in a separate function
Date: Sat, 7 Nov 2009 13:16:15 -0200 [thread overview]
Message-ID: <7206ef594e67a240a842339f520284de6569b1fc.1257602781.git.andre.goddard__4529.77375030077$1257837059$gmane$org@gmail.com> (raw)
In-Reply-To: <cover.1257602781.git.andre.goddard@gmail.com>
In-Reply-To: <cover.1257602781.git.andre.goddard@gmail.com>
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.goddard@gmail.com>
Acked-by: Frederic Weisbecker <fweisbec@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
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
next prev parent reply other threads:[~2009-11-08 15:21 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-07 15:16 [PATCH v4 00/12] introduce skip_spaces(), reducing code size plus some clean-ups André Goddard Rosa
2009-11-07 15:16 ` [uml-devel] " André Goddard Rosa
2009-11-07 15:16 ` [PATCH v4 01/12] vsprintf: factorize "(null)" string André Goddard Rosa
2009-11-07 15:16 ` [uml-devel] " André Goddard Rosa
2009-11-08 15:37 ` Jan Engelhardt
2009-11-08 15:49 ` André Goddard Rosa
2009-11-09 3:28 ` Rusty Russell
2009-11-10 14:33 ` André Goddard Rosa
2009-11-07 15:16 ` [uml-devel] [PATCH v4 02/12] vsprintf: pre-calculate final string length for later use André Goddard Rosa
2009-11-07 15:16 ` André Goddard Rosa
2009-11-07 15:16 ` [PATCH v4 03/12] vsprintf: give it some care to please checkpatch.pl André Goddard Rosa
2009-11-07 15:16 ` [uml-devel] " André Goddard Rosa
2009-11-07 15:16 ` [uml-devel] [PATCH v4 04/12] vsprintf: use TOLOWER whenever possible André Goddard Rosa
2009-11-07 15:16 ` André Goddard Rosa
2009-11-07 15:16 ` [uml-devel] [PATCH v4 05/12] vsprintf: reduce code size by avoiding extra check André Goddard Rosa
2009-11-07 15:16 ` André Goddard Rosa
2009-11-07 15:16 ` [uml-devel] [PATCH v4 06/12] vsprintf: move local vars to block local vars and remove unneeded ones André Goddard Rosa
2009-11-07 15:16 ` André Goddard Rosa
2009-11-07 15:16 ` [uml-devel] [PATCH v4 07/12] vsprintf: factor out skip_space code in a separate function André Goddard Rosa
2009-11-08 15:44 ` Jan Engelhardt
2009-11-08 15:52 ` André Goddard Rosa
[not found] ` <31525.1257770343@redhat.com>
2009-11-09 15:31 ` André Goddard Rosa
2009-11-07 15:16 ` André Goddard Rosa [this message]
2009-11-07 15:16 ` [PATCH v4 08/12] vsprintf: reuse almost identical simple_strtoulX() functions André Goddard Rosa
2009-11-07 15:16 ` [uml-devel] " André Goddard Rosa
2009-11-07 16:33 ` André Goddard Rosa
2009-11-07 15:16 ` [PATCH v4 09/12] ctype: constify read-only _ctype string André Goddard Rosa
2009-11-07 15:16 ` [uml-devel] " André Goddard Rosa
2009-11-07 15:16 ` [PATCH v4 10/12] string: factorize skip_spaces and export it to be generally available André Goddard Rosa
2009-11-07 16:23 ` André Goddard Rosa
2009-11-07 15:16 ` [uml-devel] " André Goddard Rosa
2009-11-08 15:54 ` Jan Engelhardt
2009-11-08 16:38 ` James Bottomley
2009-11-08 16:54 ` Jan Engelhardt
2009-11-08 16:59 ` André Goddard Rosa
2009-11-08 16:50 ` Alan Cox
2009-11-08 16:50 ` [uml-devel] " Alan Cox
2009-11-08 16:50 ` Alan Cox
2009-11-09 14:02 ` André Goddard Rosa
2009-11-08 16:56 ` Jan Engelhardt
2009-11-07 15:16 ` André Goddard Rosa
2009-11-07 15:16 ` [uml-devel] [PATCH v4 11/12] string: on strstrip(), first remove leading spaces before running over str André Goddard Rosa
2009-11-07 15:16 ` André Goddard Rosa
2009-11-07 15:16 ` [PATCH v4 12/12] tree-wide: convert open calls to remove spaces to skip_spaces() lib function André Goddard Rosa
2009-11-07 15:16 ` André Goddard Rosa
2009-11-07 15:16 ` [uml-devel] " André Goddard Rosa
2009-11-08 18:47 ` Theodore Tso
2009-11-08 18:47 ` [uml-devel] " Theodore Tso
2009-11-08 18:47 ` Theodore Tso
2009-11-08 18:47 ` Theodore Tso
2009-11-08 20:23 ` Julia Lawall
2009-11-08 20:23 ` [uml-devel] " Julia Lawall
2009-11-15 6:19 ` André Goddard Rosa
2009-11-15 6:37 ` André Goddard Rosa
2009-11-14 4:20 ` [ibm-acpi-devel] " Henrique de Moraes Holschuh
2009-11-14 7:44 ` André Goddard Rosa
2009-11-08 16:05 ` [dm-devel] [PATCH v4 00/12] introduce skip_spaces(), reducing code size plus some clean-ups James Bottomley
2009-11-08 16:05 ` James Bottomley
2009-11-08 16:05 ` [uml-devel] " James Bottomley
2009-11-08 16:05 ` James Bottomley
2009-11-08 16:05 ` James Bottomley
2009-11-08 16:52 ` André Goddard Rosa
2009-11-08 16:52 ` [uml-devel] " André Goddard Rosa
2009-11-08 16:52 ` André Goddard Rosa
2009-11-08 16:55 ` Jan Engelhardt
2009-11-08 17:02 ` Alexey Dobriyan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='7206ef594e67a240a842339f520284de6569b1fc.1257602781.git.andre.goddard__4529.77375030077$1257837059$gmane$org@gmail.com' \
--to=andre.goddard@gmail.com \
--cc=akpm@linux-f \
--cc=heiko.carstens@de.ibm.com \
--cc=holzheu@linux.vnet.ibm.com \
--cc=linux390@de.ibm.com \
--cc=schwidefsky@de.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.