string: factorize skip_spaces and export it to be generally available
[safe/jmp/linux-2.6] / lib / string.c
index e96421a..3a912a4 100644 (file)
@@ -338,6 +338,20 @@ EXPORT_SYMBOL(strnchr);
 #endif
 
 /**
+ * skip_spaces - Removes leading whitespace from @s.
+ * @s: The string to be stripped.
+ *
+ * Returns a pointer to the first non-whitespace character in @s.
+ */
+char *skip_spaces(const char *str)
+{
+       while (isspace(*str))
+               ++str;
+       return (char *)str;
+}
+EXPORT_SYMBOL(skip_spaces);
+
+/**
  * strstrip - Removes leading and trailing whitespace from @s.
  * @s: The string to be stripped.
  *
@@ -360,10 +374,7 @@ char *strstrip(char *s)
                end--;
        *(end + 1) = '\0';
 
-       while (*s && isspace(*s))
-               s++;
-
-       return s;
+       return skip_spaces(s);
 }
 EXPORT_SYMBOL(strstrip);