[<prev] [next>] [day] [month] [year] [list]
Message-Id: <200912042232.nB4MWHmk011759@imap1.linux-foundation.org>
Date: Fri, 04 Dec 2009 14:32:16 -0800
From: akpm@...ux-foundation.org
To: mm-commits@...r.kernel.org
Cc: andre.goddard@...il.com, dhowells@...hat.com, hmh@....eng.br,
hpa@...or.com, jdike@...toit.com, julia@...u.dk, kaber@...sh.net,
kyle@...artin.ca, linux-ext4@...r.kernel.org, mingo@...e.hu,
neilb@...e.de, rpurdie@...ys.net, samuel@...tiz.org,
schwidefsky@...ibm.com, tglx@...utronix.de, tiwai@...e.de
Subject: + tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function.patch added to -mm tree
The patch titled
tree-wide: convert open calls to remove spaces to skip_spaces() lib function
has been added to the -mm tree. Its filename is
tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-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: tree-wide: convert open calls to remove spaces to skip_spaces() lib function
From: André Goddard Rosa <andre.goddard@...il.com>
Makes use of skip_spaces() defined in lib/string.c for removing leading
spaces from strings all over the tree.
It decreases lib.a code size by 47 bytes and reuses the function tree-wide:
text data bss dec hex filename
64688 584 592 65864 10148 (TOTALS-BEFORE)
64641 584 592 65817 10119 (TOTALS-AFTER)
Also, while at it, if we see (*str && isspace(*str)), we can be sure to
remove the first condition (*str) as the second one (isspace(*str)) also
evaluates to 0 whenever *str == 0, making it redundant. In other words,
"a char equals zero is never a space".
Julia Lawall tried the semantic patch (http://coccinelle.lip6.fr) below,
and found occurrences of this pattern on 3 more files:
drivers/leds/led-class.c
drivers/leds/ledtrig-timer.c
drivers/video/output.c
@@
expression str;
@@
( // ignore skip_spaces cases
while (*str && isspace(*str)) { \(str++;\|++str;\) }
|
- *str &&
isspace(*str)
)
Signed-off-by: André Goddard Rosa <andre.goddard@...il.com>
Cc: Julia Lawall <julia@...u.dk>
Cc: Martin Schwidefsky <schwidefsky@...ibm.com>
Cc: Jeff Dike <jdike@...toit.com>
Cc: Ingo Molnar <mingo@...e.hu>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: "H. Peter Anvin" <hpa@...or.com>
Cc: Richard Purdie <rpurdie@...ys.net>
Cc: Neil Brown <neilb@...e.de>
Cc: Kyle McMartin <kyle@...artin.ca>
Cc: Henrique de Moraes Holschuh <hmh@....eng.br>
Cc: David Howells <dhowells@...hat.com>
Cc: <linux-ext4@...r.kernel.org>
Cc: Samuel Ortiz <samuel@...tiz.org>
Cc: Patrick McHardy <kaber@...sh.net>
Cc: Takashi Iwai <tiwai@...e.de>
Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
---
arch/s390/kernel/debug.c | 3 +-
arch/um/drivers/mconsole_kern.c | 16 ++++------
arch/x86/kernel/cpu/mtrr/if.c | 11 ++-----
drivers/leds/led-class.c | 2 -
drivers/leds/ledtrig-timer.c | 4 +-
drivers/md/dm-table.c | 6 +---
drivers/md/md.c | 4 +-
drivers/parisc/pdc_stable.c | 9 ++----
drivers/platform/x86/thinkpad_acpi.c | 7 +---
drivers/pnp/interface.c | 36 ++++++------------------
drivers/s390/block/dasd_proc.c | 5 ++-
drivers/video/backlight/lcd.c | 4 +-
drivers/video/display/display-sysfs.c | 2 -
drivers/video/output.c | 2 -
fs/cachefiles/daemon.c | 4 +-
fs/ext4/super.c | 7 +---
kernel/params.c | 8 ++---
lib/argv_split.c | 13 ++------
lib/dynamic_debug.c | 4 +-
lib/vsprintf.c | 15 ++--------
net/irda/irnet/irnet.h | 1
net/irda/irnet/irnet_ppp.c | 8 ++---
net/netfilter/xt_recent.c | 3 --
sound/pci/hda/hda_hwdep.c | 7 ++--
24 files changed, 66 insertions(+), 115 deletions(-)
diff -puN arch/s390/kernel/debug.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function arch/s390/kernel/debug.c
--- a/arch/s390/kernel/debug.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function
+++ a/arch/s390/kernel/debug.c
@@ -18,6 +18,7 @@
#include <linux/errno.h>
#include <linux/slab.h>
#include <linux/ctype.h>
+#include <linux/string.h>
#include <linux/sysctl.h>
#include <asm/uaccess.h>
#include <linux/module.h>
@@ -1178,7 +1179,7 @@ debug_get_uint(char *buf)
{
int rc;
- for(; isspace(*buf); buf++);
+ buf = skip_spaces(buf);
rc = simple_strtoul(buf, &buf, 10);
if(*buf){
rc = -EINVAL;
diff -puN arch/um/drivers/mconsole_kern.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function arch/um/drivers/mconsole_kern.c
--- a/arch/um/drivers/mconsole_kern.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function
+++ a/arch/um/drivers/mconsole_kern.c
@@ -6,6 +6,7 @@
#include <linux/console.h>
#include <linux/ctype.h>
+#include <linux/string.h>
#include <linux/interrupt.h>
#include <linux/list.h>
#include <linux/mm.h>
@@ -131,7 +132,7 @@ void mconsole_proc(struct mc_request *re
char *ptr = req->request.data, *buf;
ptr += strlen("proc");
- while (isspace(*ptr)) ptr++;
+ ptr = skip_spaces(ptr);
proc = get_fs_type("proc");
if (proc == NULL) {
@@ -212,8 +213,7 @@ void mconsole_proc(struct mc_request *re
char *ptr = req->request.data;
ptr += strlen("proc");
- while (isspace(*ptr))
- ptr++;
+ ptr = skip_spaces(ptr);
snprintf(path, sizeof(path), "/proc/%s", ptr);
fd = sys_open(path, 0, 0);
@@ -560,8 +560,7 @@ void mconsole_config(struct mc_request *
int err;
ptr += strlen("config");
- while (isspace(*ptr))
- ptr++;
+ ptr = skip_spaces(ptr);
dev = mconsole_find_dev(ptr);
if (dev == NULL) {
mconsole_reply(req, "Bad configuration option", 1, 0);
@@ -588,7 +587,7 @@ void mconsole_remove(struct mc_request *
int err, start, end, n;
ptr += strlen("remove");
- while (isspace(*ptr)) ptr++;
+ ptr = skip_spaces(ptr);
dev = mconsole_find_dev(ptr);
if (dev == NULL) {
mconsole_reply(req, "Bad remove option", 1, 0);
@@ -712,7 +711,7 @@ void mconsole_sysrq(struct mc_request *r
char *ptr = req->request.data;
ptr += strlen("sysrq");
- while (isspace(*ptr)) ptr++;
+ ptr = skip_spaces(ptr);
/*
* With 'b', the system will shut down without a chance to reply,
@@ -757,8 +756,7 @@ void mconsole_stack(struct mc_request *r
*/
ptr += strlen("stack");
- while (isspace(*ptr))
- ptr++;
+ ptr = skip_spaces(ptr);
/*
* Should really check for multiple pids or reject bad args here
diff -puN arch/x86/kernel/cpu/mtrr/if.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function arch/x86/kernel/cpu/mtrr/if.c
--- a/arch/x86/kernel/cpu/mtrr/if.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function
+++ a/arch/x86/kernel/cpu/mtrr/if.c
@@ -4,6 +4,7 @@
#include <linux/proc_fs.h>
#include <linux/module.h>
#include <linux/ctype.h>
+#include <linux/string.h>
#include <linux/init.h>
#define LINE_SIZE 80
@@ -133,8 +134,7 @@ mtrr_write(struct file *file, const char
return -EINVAL;
base = simple_strtoull(line + 5, &ptr, 0);
- while (isspace(*ptr))
- ptr++;
+ ptr = skip_spaces(ptr);
if (strncmp(ptr, "size=", 5))
return -EINVAL;
@@ -142,14 +142,11 @@ mtrr_write(struct file *file, const char
size = simple_strtoull(ptr + 5, &ptr, 0);
if ((base & 0xfff) || (size & 0xfff))
return -EINVAL;
- while (isspace(*ptr))
- ptr++;
+ ptr = skip_spaces(ptr);
if (strncmp(ptr, "type=", 5))
return -EINVAL;
- ptr += 5;
- while (isspace(*ptr))
- ptr++;
+ ptr = skip_spaces(ptr + 5);
for (i = 0; i < MTRR_NUM_TYPES; ++i) {
if (strcmp(ptr, mtrr_strings[i]))
diff -puN drivers/leds/led-class.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function drivers/leds/led-class.c
--- a/drivers/leds/led-class.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function
+++ a/drivers/leds/led-class.c
@@ -50,7 +50,7 @@ static ssize_t led_brightness_store(stru
unsigned long state = simple_strtoul(buf, &after, 10);
size_t count = after - buf;
- if (*after && isspace(*after))
+ if (isspace(*after))
count++;
if (count == size) {
diff -puN drivers/leds/ledtrig-timer.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function drivers/leds/ledtrig-timer.c
--- a/drivers/leds/ledtrig-timer.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function
+++ a/drivers/leds/ledtrig-timer.c
@@ -83,7 +83,7 @@ static ssize_t led_delay_on_store(struct
unsigned long state = simple_strtoul(buf, &after, 10);
size_t count = after - buf;
- if (*after && isspace(*after))
+ if (isspace(*after))
count++;
if (count == size) {
@@ -127,7 +127,7 @@ static ssize_t led_delay_off_store(struc
unsigned long state = simple_strtoul(buf, &after, 10);
size_t count = after - buf;
- if (*after && isspace(*after))
+ if (isspace(*after))
count++;
if (count == size) {
diff -puN drivers/md/dm-table.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function drivers/md/dm-table.c
--- a/drivers/md/dm-table.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function
+++ a/drivers/md/dm-table.c
@@ -12,6 +12,7 @@
#include <linux/blkdev.h>
#include <linux/namei.h>
#include <linux/ctype.h>
+#include <linux/string.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/mutex.h>
@@ -603,11 +604,8 @@ int dm_split_args(int *argc, char ***arg
return -ENOMEM;
while (1) {
- start = end;
-
/* Skip whitespace */
- while (*start && isspace(*start))
- start++;
+ start = skip_spaces(end);
if (!*start)
break; /* success, we hit the end */
diff -puN drivers/md/md.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function drivers/md/md.c
--- a/drivers/md/md.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function
+++ a/drivers/md/md.c
@@ -39,6 +39,7 @@
#include <linux/buffer_head.h> /* for invalidate_bdev */
#include <linux/poll.h>
#include <linux/ctype.h>
+#include <linux/string.h>
#include <linux/hdreg.h>
#include <linux/proc_fs.h>
#include <linux/random.h>
@@ -3392,8 +3393,7 @@ bitmap_store(mddev_t *mddev, const char
}
if (*end && !isspace(*end)) break;
bitmap_dirty_bits(mddev->bitmap, chunk, end_chunk);
- buf = end;
- while (isspace(*buf)) buf++;
+ buf = skip_spaces(end);
}
bitmap_unplug(mddev->bitmap); /* flush the bits to disk */
out:
diff -puN drivers/parisc/pdc_stable.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function drivers/parisc/pdc_stable.c
--- a/drivers/parisc/pdc_stable.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function
+++ a/drivers/parisc/pdc_stable.c
@@ -779,12 +779,9 @@ static ssize_t pdcs_auto_write(struct ko
read_unlock(&pathentry->rw_lock);
DPRINTK("%s: flags before: 0x%X\n", __func__, flags);
-
- temp = in;
-
- while (*temp && isspace(*temp))
- temp++;
-
+
+ temp = skip_spaces(in);
+
c = *temp++ - '0';
if ((c != 0) && (c != 1))
goto parse_error;
diff -puN drivers/platform/x86/thinkpad_acpi.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function drivers/platform/x86/thinkpad_acpi.c
--- a/drivers/platform/x86/thinkpad_acpi.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function
+++ a/drivers/platform/x86/thinkpad_acpi.c
@@ -1005,11 +1005,8 @@ static int parse_strtoul(const char *buf
{
char *endp;
- while (*buf && isspace(*buf))
- buf++;
- *value = simple_strtoul(buf, &endp, 0);
- while (*endp && isspace(*endp))
- endp++;
+ *value = simple_strtoul(skip_spaces(buf), &endp, 0);
+ endp = skip_spaces(endp);
if (*endp || *value > max)
return -EINVAL;
diff -puN drivers/pnp/interface.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function drivers/pnp/interface.c
--- a/drivers/pnp/interface.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function
+++ a/drivers/pnp/interface.c
@@ -310,8 +310,7 @@ static ssize_t pnp_set_current_resources
goto done;
}
- while (isspace(*buf))
- ++buf;
+ buf = skip_spaces(buf);
if (!strnicmp(buf, "disable", 7)) {
retval = pnp_disable_dev(dev);
goto done;
@@ -353,19 +352,13 @@ static ssize_t pnp_set_current_resources
pnp_init_resources(dev);
mutex_lock(&pnp_res_mutex);
while (1) {
- while (isspace(*buf))
- ++buf;
+ buf = skip_spaces(buf);
if (!strnicmp(buf, "io", 2)) {
- buf += 2;
- while (isspace(*buf))
- ++buf;
+ buf = skip_spaces(buf + 2);
start = simple_strtoul(buf, &buf, 0);
- while (isspace(*buf))
- ++buf;
+ buf = skip_spaces(buf);
if (*buf == '-') {
- buf += 1;
- while (isspace(*buf))
- ++buf;
+ buf = skip_spaces(buf + 1);
end = simple_strtoul(buf, &buf, 0);
} else
end = start;
@@ -373,16 +366,11 @@ static ssize_t pnp_set_current_resources
continue;
}
if (!strnicmp(buf, "mem", 3)) {
- buf += 3;
- while (isspace(*buf))
- ++buf;
+ buf = skip_spaces(buf + 3);
start = simple_strtoul(buf, &buf, 0);
- while (isspace(*buf))
- ++buf;
+ buf = skip_spaces(buf);
if (*buf == '-') {
- buf += 1;
- while (isspace(*buf))
- ++buf;
+ buf = skip_spaces(buf + 1);
end = simple_strtoul(buf, &buf, 0);
} else
end = start;
@@ -390,17 +378,13 @@ static ssize_t pnp_set_current_resources
continue;
}
if (!strnicmp(buf, "irq", 3)) {
- buf += 3;
- while (isspace(*buf))
- ++buf;
+ buf = skip_spaces(buf + 3);
start = simple_strtoul(buf, &buf, 0);
pnp_add_irq_resource(dev, start, 0);
continue;
}
if (!strnicmp(buf, "dma", 3)) {
- buf += 3;
- while (isspace(*buf))
- ++buf;
+ buf = skip_spaces(buf + 3);
start = simple_strtoul(buf, &buf, 0);
pnp_add_dma_resource(dev, start, 0);
continue;
diff -puN drivers/s390/block/dasd_proc.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function drivers/s390/block/dasd_proc.c
--- a/drivers/s390/block/dasd_proc.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function
+++ a/drivers/s390/block/dasd_proc.c
@@ -14,6 +14,7 @@
#define KMSG_COMPONENT "dasd"
#include <linux/ctype.h>
+#include <linux/string.h>
#include <linux/seq_file.h>
#include <linux/vmalloc.h>
#include <linux/proc_fs.h>
@@ -272,10 +273,10 @@ dasd_statistics_write(struct file *file,
DBF_EVENT(DBF_DEBUG, "/proc/dasd/statictics: '%s'\n", buffer);
/* check for valid verbs */
- for (str = buffer; isspace(*str); str++);
+ str = skip_spaces(buffer);
if (strncmp(str, "set", 3) == 0 && isspace(str[3])) {
/* 'set xxx' was given */
- for (str = str + 4; isspace(*str); str++);
+ str = skip_spaces(str + 4);
if (strcmp(str, "on") == 0) {
/* switch on statistics profiling */
dasd_profile_level = DASD_PROFILE_ON;
diff -puN drivers/video/backlight/lcd.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function drivers/video/backlight/lcd.c
--- a/drivers/video/backlight/lcd.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function
+++ a/drivers/video/backlight/lcd.c
@@ -101,7 +101,7 @@ static ssize_t lcd_store_power(struct de
int power = simple_strtoul(buf, &endp, 0);
size_t size = endp - buf;
- if (*endp && isspace(*endp))
+ if (isspace(*endp))
size++;
if (size != count)
return -EINVAL;
@@ -140,7 +140,7 @@ static ssize_t lcd_store_contrast(struct
int contrast = simple_strtoul(buf, &endp, 0);
size_t size = endp - buf;
- if (*endp && isspace(*endp))
+ if (isspace(*endp))
size++;
if (size != count)
return -EINVAL;
diff -puN drivers/video/display/display-sysfs.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function drivers/video/display/display-sysfs.c
--- a/drivers/video/display/display-sysfs.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function
+++ a/drivers/video/display/display-sysfs.c
@@ -67,7 +67,7 @@ static ssize_t display_store_contrast(st
contrast = simple_strtoul(buf, &endp, 0);
size = endp - buf;
- if (*endp && isspace(*endp))
+ if (isspace(*endp))
size++;
if (size != count)
diff -puN drivers/video/output.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function drivers/video/output.c
--- a/drivers/video/output.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function
+++ a/drivers/video/output.c
@@ -50,7 +50,7 @@ static ssize_t video_output_store_state(
int request_state = simple_strtoul(buf,&endp,0);
size_t size = endp - buf;
- if (*endp && isspace(*endp))
+ if (isspace(*endp))
size++;
if (size != count)
return -EINVAL;
diff -puN fs/cachefiles/daemon.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function fs/cachefiles/daemon.c
--- a/fs/cachefiles/daemon.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function
+++ a/fs/cachefiles/daemon.c
@@ -21,6 +21,7 @@
#include <linux/mount.h>
#include <linux/statfs.h>
#include <linux/ctype.h>
+#include <linux/string.h>
#include <linux/fs_struct.h>
#include "internal.h"
@@ -257,8 +258,7 @@ static ssize_t cachefiles_daemon_write(s
if (args == data)
goto error;
*args = '\0';
- for (args++; isspace(*args); args++)
- continue;
+ args = skip_spaces(++args);
}
/* run the appropriate command handler */
diff -puN fs/ext4/super.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function fs/ext4/super.c
--- a/fs/ext4/super.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function
+++ a/fs/ext4/super.c
@@ -2133,11 +2133,8 @@ static int parse_strtoul(const char *buf
{
char *endp;
- while (*buf && isspace(*buf))
- buf++;
- *value = simple_strtoul(buf, &endp, 0);
- while (*endp && isspace(*endp))
- endp++;
+ *value = simple_strtoul(skip_spaces(buf), &endp, 0);
+ endp = skip_spaces(endp);
if (*endp || *value > max)
return -EINVAL;
diff -puN kernel/params.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function kernel/params.c
--- a/kernel/params.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function
+++ a/kernel/params.c
@@ -24,6 +24,7 @@
#include <linux/err.h>
#include <linux/slab.h>
#include <linux/ctype.h>
+#include <linux/string.h>
#if 0
#define DEBUGP printk
@@ -162,9 +163,7 @@ static char *next_arg(char *args, char *
next = args + i;
/* Chew up trailing spaces. */
- while (isspace(*next))
- next++;
- return next;
+ return skip_spaces(next);
}
/* Args looks like "foo=bar,bar2 baz=fuz wiz". */
@@ -179,8 +178,7 @@ int parse_args(const char *name,
DEBUGP("Parsing ARGS: %s\n", args);
/* Chew leading spaces */
- while (isspace(*args))
- args++;
+ args = skip_spaces(args);
while (*args) {
int ret;
diff -puN lib/argv_split.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function lib/argv_split.c
--- a/lib/argv_split.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function
+++ a/lib/argv_split.c
@@ -4,17 +4,10 @@
#include <linux/kernel.h>
#include <linux/ctype.h>
+#include <linux/string.h>
#include <linux/slab.h>
#include <linux/module.h>
-static const char *skip_sep(const char *cp)
-{
- while (*cp && isspace(*cp))
- cp++;
-
- return cp;
-}
-
static const char *skip_arg(const char *cp)
{
while (*cp && !isspace(*cp))
@@ -28,7 +21,7 @@ static int count_argc(const char *str)
int count = 0;
while (*str) {
- str = skip_sep(str);
+ str = skip_spaces(str);
if (*str) {
count++;
str = skip_arg(str);
@@ -82,7 +75,7 @@ char **argv_split(gfp_t gfp, const char
argvp = argv;
while (*str) {
- str = skip_sep(str);
+ str = skip_spaces(str);
if (*str) {
const char *p = str;
diff -puN lib/dynamic_debug.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function lib/dynamic_debug.c
--- a/lib/dynamic_debug.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function
+++ a/lib/dynamic_debug.c
@@ -21,6 +21,7 @@
#include <linux/list.h>
#include <linux/sysctl.h>
#include <linux/ctype.h>
+#include <linux/string.h>
#include <linux/uaccess.h>
#include <linux/dynamic_debug.h>
#include <linux/debugfs.h>
@@ -209,8 +210,7 @@ static int ddebug_tokenize(char *buf, ch
char *end;
/* Skip leading whitespace */
- while (*buf && isspace(*buf))
- buf++;
+ buf = skip_spaces(buf);
if (!*buf)
break; /* oh, it was trailing whitespace */
diff -puN lib/vsprintf.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function lib/vsprintf.c
--- a/lib/vsprintf.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function
+++ a/lib/vsprintf.c
@@ -1766,13 +1766,6 @@ 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
@@ -1794,8 +1787,8 @@ int vsscanf(const char *buf, const char
* white space, including none, in the input.
*/
if (isspace(*fmt)) {
- fmt = skip_space(fmt);
- str = skip_space(str);
+ fmt = skip_spaces(++fmt);
+ str = skip_spaces(str);
}
/* anything that is not a conversion must match exactly */
@@ -1865,7 +1858,7 @@ int vsscanf(const char *buf, const char
if (field_width == -1)
field_width = INT_MAX;
/* first, skip leading white space in buffer */
- str = skip_space(str);
+ str = skip_spaces(str);
/* now copy until next white space */
while (*str && !isspace(*str) && field_width--)
@@ -1907,7 +1900,7 @@ int vsscanf(const char *buf, const char
/* have some sort of integer conversion.
* first, skip white space in buffer.
*/
- str = skip_space(str);
+ str = skip_spaces(str);
digit = *str;
if (is_sign && digit == '-')
diff -puN net/irda/irnet/irnet.h~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function net/irda/irnet/irnet.h
--- a/net/irda/irnet/irnet.h~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function
+++ a/net/irda/irnet/irnet.h
@@ -249,6 +249,7 @@
#include <linux/poll.h>
#include <linux/capability.h>
#include <linux/ctype.h> /* isspace() */
+#include <linux/string.h> /* skip_spaces() */
#include <asm/uaccess.h>
#include <linux/init.h>
diff -puN net/irda/irnet/irnet_ppp.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function net/irda/irnet/irnet_ppp.c
--- a/net/irda/irnet/irnet_ppp.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function
+++ a/net/irda/irnet/irnet_ppp.c
@@ -76,9 +76,8 @@ irnet_ctrl_write(irnet_socket * ap,
/* Look at the next command */
start = next;
- /* Scrap whitespaces before the command */
- while(isspace(*start))
- start++;
+ /* Scrap whitespaces before the command */
+ start = skip_spaces(start);
/* ',' is our command separator */
next = strchr(start, ',');
@@ -133,8 +132,7 @@ irnet_ctrl_write(irnet_socket * ap,
char * endp;
/* Scrap whitespaces before the command */
- while(isspace(*begp))
- begp++;
+ begp = skip_spaces(begp);
/* Convert argument to a number (last arg is the base) */
addr = simple_strtoul(begp, &endp, 16);
diff -puN net/netfilter/xt_recent.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function net/netfilter/xt_recent.c
--- a/net/netfilter/xt_recent.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function
+++ a/net/netfilter/xt_recent.c
@@ -482,8 +482,7 @@ static ssize_t recent_old_proc_write(str
if (copy_from_user(buf, input, size))
return -EFAULT;
- while (isspace(*c))
- c++;
+ c = skip_spaces(c);
if (size - (c - buf) < 5)
return c - buf;
diff -puN sound/pci/hda/hda_hwdep.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function sound/pci/hda/hda_hwdep.c
--- a/sound/pci/hda/hda_hwdep.c~tree-wide-convert-open-calls-to-remove-spaces-to-skip_spaces-lib-function
+++ a/sound/pci/hda/hda_hwdep.c
@@ -24,6 +24,7 @@
#include <linux/compat.h>
#include <linux/mutex.h>
#include <linux/ctype.h>
+#include <linux/string.h>
#include <linux/firmware.h>
#include <sound/core.h>
#include "hda_codec.h"
@@ -428,8 +429,7 @@ static int parse_hints(struct hda_codec
char *key, *val;
struct hda_hint *hint;
- while (isspace(*buf))
- buf++;
+ buf = skip_spaces(buf);
if (!*buf || *buf == '#' || *buf == '\n')
return 0;
if (*buf == '=')
@@ -444,8 +444,7 @@ static int parse_hints(struct hda_codec
return -EINVAL;
}
*val++ = 0;
- while (isspace(*val))
- val++;
+ val = skip_spaces(val);
remove_trail_spaces(key);
remove_trail_spaces(val);
hint = get_hint(codec, key);
_
Patches currently in -mm which might be from andre.goddard@...il.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 linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists