Skip to content

Commit

Permalink
staging/lustre/libcfs: remove cfs_iswhite
Browse files Browse the repository at this point in the history
Kernel provides isspace().

Cc: Andreas Dilger <[email protected]>
Cc: Oleg Drokin <[email protected]>
Signed-off-by: Peng Tao <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
bergwolf authored and gregkh committed Mar 9, 2014
1 parent 31fb613 commit e525a68
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 26 deletions.
15 changes: 0 additions & 15 deletions drivers/staging/lustre/include/linux/libcfs/libcfs_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,21 +90,6 @@ struct cfs_expr_list {
struct list_head el_exprs;
};

static inline int
cfs_iswhite(char c)
{
switch (c) {
case ' ':
case '\t':
case '\n':
case '\r':
return 1;
default:
break;
}
return 0;
}

char *cfs_trimwhite(char *str);
int cfs_gettok(struct cfs_lstr *next, char delim, struct cfs_lstr *res);
int cfs_str2num_check(char *str, int nob, unsigned *num,
Expand Down
12 changes: 6 additions & 6 deletions drivers/staging/lustre/lnet/lnet/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ lnet_str2tbs_sep(struct list_head *tbs, char *str)
/* Split 'str' into separate commands */
for (;;) {
/* skip leading whitespace */
while (cfs_iswhite(*str))
while (isspace(*str))
str++;

/* scan for separator or comment */
Expand All @@ -460,7 +460,7 @@ lnet_str2tbs_sep(struct list_head *tbs, char *str)
}

for (i = 0; i < nob; i++)
if (cfs_iswhite(str[i]))
if (isspace(str[i]))
ltb->ltb_text[i] = ' ';
else
ltb->ltb_text[i] = str[i];
Expand Down Expand Up @@ -667,7 +667,7 @@ lnet_parse_route(char *str, int *im_a_router)
sep = str;
for (;;) {
/* scan for token start */
while (cfs_iswhite(*sep))
while (isspace(*sep))
sep++;
if (*sep == 0) {
if (ntokens < (got_hops ? 3 : 2))
Expand All @@ -679,7 +679,7 @@ lnet_parse_route(char *str, int *im_a_router)
token = sep++;

/* scan for token end */
while (*sep != 0 && !cfs_iswhite(*sep))
while (*sep != 0 && !isspace(*sep))
sep++;
if (*sep != 0)
*sep++ = 0;
Expand Down Expand Up @@ -858,15 +858,15 @@ lnet_match_network_tokens(char *net_entry, __u32 *ipaddrs, int nip)
sep = tokens;
for (;;) {
/* scan for token start */
while (cfs_iswhite(*sep))
while (isspace(*sep))
sep++;
if (*sep == 0)
break;

token = sep++;

/* scan for token end */
while (*sep != 0 && !cfs_iswhite(*sep))
while (*sep != 0 && !isspace(*sep))
sep++;
if (*sep != 0)
*sep++ = 0;
Expand Down
10 changes: 5 additions & 5 deletions drivers/staging/lustre/lustre/libcfs/libcfs_string.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,12 @@ cfs_trimwhite(char *str)
{
char *end;

while (cfs_iswhite(*str))
while (isspace(*str))
str++;

end = str + strlen(str);
while (end > str) {
if (!cfs_iswhite(end[-1]))
if (!isspace(end[-1]))
break;
end--;
}
Expand Down Expand Up @@ -178,7 +178,7 @@ cfs_gettok(struct cfs_lstr *next, char delim, struct cfs_lstr *res)

/* skip leading white spaces */
while (next->ls_len) {
if (!cfs_iswhite(*next->ls_str))
if (!isspace(*next->ls_str))
break;
next->ls_str++;
next->ls_len--;
Expand All @@ -205,7 +205,7 @@ cfs_gettok(struct cfs_lstr *next, char delim, struct cfs_lstr *res)

/* skip ending whitespaces */
while (--end != res->ls_str) {
if (!cfs_iswhite(*end))
if (!isspace(*end))
break;
}

Expand Down Expand Up @@ -234,7 +234,7 @@ cfs_str2num_check(char *str, int nob, unsigned *num,
return 0;

for (; endp < str + nob; endp++) {
if (!cfs_iswhite(*endp))
if (!isspace(*endp))
return 0;
}

Expand Down

0 comments on commit e525a68

Please sign in to comment.