Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 176374
b: refs/heads/master
c: f653398
h: refs/heads/master
v: v3
  • Loading branch information
André Goddard Rosa authored and Linus Torvalds committed Dec 15, 2009
1 parent 2699cae commit 059cce9
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4e62b0930223fe2f61094ceb1bbb31b3fe4251c2
refs/heads/master: f653398c86a1c104f0992bd788dd4bb065449be4
1 change: 1 addition & 0 deletions trunk/include/linux/ctype.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ extern const unsigned char _ctype[];
#define islower(c) ((__ismask(c)&(_L)) != 0)
#define isprint(c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0)
#define ispunct(c) ((__ismask(c)&(_P)) != 0)
/* Note: isspace() must return false for %NUL-terminator */
#define isspace(c) ((__ismask(c)&(_S)) != 0)
#define isupper(c) ((__ismask(c)&(_U)) != 0)
#define isxdigit(c) ((__ismask(c)&(_D|_X)) != 0)
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ extern char * strnchr(const char *, size_t, int);
#ifndef __HAVE_ARCH_STRRCHR
extern char * strrchr(const char *,int);
#endif
extern char * __must_check skip_spaces(const char *);
extern char * __must_check strstrip(char *);
#ifndef __HAVE_ARCH_STRSTR
extern char * strstr(const char *,const char *);
Expand Down
19 changes: 15 additions & 4 deletions trunk/lib/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,20 @@ char *strnchr(const char *s, size_t count, int c)
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.
Expand All @@ -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);

Expand Down

0 comments on commit 059cce9

Please sign in to comment.