Age | Commit message (Collapse) | Author | Files | Lines |
|
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 <[email protected]>
Cc: Julia Lawall <[email protected]>
Cc: Martin Schwidefsky <[email protected]>
Cc: Jeff Dike <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Richard Purdie <[email protected]>
Cc: Neil Brown <[email protected]>
Cc: Kyle McMartin <[email protected]>
Cc: Henrique de Moraes Holschuh <[email protected]>
Cc: David Howells <[email protected]>
Cc: <[email protected]>
Cc: Samuel Ortiz <[email protected]>
Cc: Patrick McHardy <[email protected]>
Cc: Takashi Iwai <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
Replace an irrelevant include of bug.h with the more appropriate
includes of slab.h and module.h.
it's not as if the original inclusion is an error, it's simply not
related to the contents of that source file, while the other two are.
compile-tested on i386.
Signed-off-by: Robert P. J. Day <[email protected]>
Signed-off-by: Adrian Bunk <[email protected]>
|
|
gracefully
It would be nice if the argv_split library function could gracefully handle
a NULL pointer in the argcp parameter, so as to allow functions using it
that did not care about the value of argc to not have to declare a useless
variable. This patch accomplishes that. Tested by me, with successful
results.
Signed-off-by: Neil Horman <[email protected]>
Acked-by: Jeremy Fitzhardinge <[email protected]>
Cc: Satyam Sharma <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
|
argv_split() is a helper function which takes a string, splits it at
whitespace, and returns a NULL-terminated argv vector. This is
deliberately simple - it does no quote processing of any kind.
[ Seems to me that this is something which is already being done in
the kernel, but I couldn't find any other implementations, either to
steal or replace. Keep an eye out. ]
Signed-off-by: Jeremy Fitzhardinge <[email protected]>
Signed-off-by: Chris Wright <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Randy Dunlap <[email protected]>
|