diff options
Diffstat (limited to 'lib/string.c')
-rw-r--r-- | lib/string.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/string.c b/lib/string.c index e96421a..3a912a4 100644 --- a/lib/string.c +++ b/lib/string.c @@ -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); |