Merge branch 'kmemleak' of git://linux-arm.org/linux-2.6
[sfrench/cifs-2.6.git] / lib / argv_split.c
index 4096ed42f490869c252b1e33ea76050fe8f1ec92..4b1b083f219cd68fd0424ff6e4c6c84f6d685d25 100644 (file)
@@ -4,15 +4,9 @@
 
 #include <linux/kernel.h>
 #include <linux/ctype.h>
-#include <linux/bug.h>
-
-static const char *skip_sep(const char *cp)
-{
-       while (*cp && isspace(*cp))
-               cp++;
-
-       return cp;
-}
+#include <linux/string.h>
+#include <linux/slab.h>
+#include <linux/module.h>
 
 static const char *skip_arg(const char *cp)
 {
@@ -27,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);
@@ -75,11 +69,13 @@ char **argv_split(gfp_t gfp, const char *str, int *argcp)
        if (argv == NULL)
                goto out;
 
-       *argcp = argc;
+       if (argcp)
+               *argcp = argc;
+
        argvp = argv;
 
        while (*str) {
-               str = skip_sep(str);
+               str = skip_spaces(str);
 
                if (*str) {
                        const char *p = str;