* + vsprintf-factor-out-skip_space-code-in-a-separate-function.patch added to -mm tree
@ 2009-12-04 22:32 akpm
0 siblings, 0 replies; only message in thread
From: akpm @ 2009-12-04 22:32 UTC (permalink / raw)
To: mm-commits; +Cc: andre.goddard, fweisbec
The patch titled
vsprintf: factor out skip_space code in a separate function
has been added to the -mm tree. Its filename is
vsprintf-factor-out-skip_space-code-in-a-separate-function.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
out what to do about this
The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/
------------------------------------------------------
Subject: vsprintf: factor out skip_space code in a separate function
From: André Goddard Rosa <andre.goddard@gmail.com>
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>
---
lib/vsprintf.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff -puN lib/vsprintf.c~vsprintf-factor-out-skip_space-code-in-a-separate-function lib/vsprintf.c
--- a/lib/vsprintf.c~vsprintf-factor-out-skip_space-code-in-a-separate-function
+++ a/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
* 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
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
/* 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 == '-')
_
Patches currently in -mm which might be from andre.goddard@gmail.com are
linux-next.patch
vsprintf-factorize-null-string.patch
vsprintf-pre-calculate-final-string-length-for-later-use.patch
vsprintf-give-it-some-care-to-please-checkpatchpl.patch
vsprintf-use-tolower-whenever-possible.patch
vsprintf-reduce-code-size-by-avoiding-extra-check.patch
vsprintf-move-local-vars-to-block-local-vars-and-remove-unneeded-ones.patch
vsprintf-factor-out-skip_space-code-in-a-separate-function.patch
vsprintf-reuse-almost-identical-simple_strtoulx-functions.patch
ctype-constify-read-only-_ctype-string.patch
string-factorize-skip_spaces-and-export-it-to-be-generally-available.patch
string-on-strstrip-first-remove-leading-spaces-before-running-over-str.patch
tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function.patch
--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-12-04 22:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-04 22:32 + vsprintf-factor-out-skip_space-code-in-a-separate-function.patch added to -mm tree akpm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).