16 Dec, 2009

1 commit

  • 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
    Cc: Julia Lawall
    Cc: Martin Schwidefsky
    Cc: Jeff Dike
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Cc: "H. Peter Anvin"
    Cc: Richard Purdie
    Cc: Neil Brown
    Cc: Kyle McMartin
    Cc: Henrique de Moraes Holschuh
    Cc: David Howells
    Cc:
    Cc: Samuel Ortiz
    Cc: Patrick McHardy
    Cc: Takashi Iwai
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    André Goddard Rosa
     

20 Oct, 2007

1 commit

  • 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
    Signed-off-by: Adrian Bunk

    Robert P. J. Day
     

17 Oct, 2007

1 commit

  • 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
    Acked-by: Jeremy Fitzhardinge
    Cc: Satyam Sharma
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Neil Horman
     

18 Jul, 2007

1 commit

  • 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
    Signed-off-by: Chris Wright
    Cc: Andrew Morton
    Cc: Randy Dunlap

    Jeremy Fitzhardinge