Commit e525a681 authored by Peng Tao's avatar Peng Tao Committed by Greg Kroah-Hartman

staging/lustre/libcfs: remove cfs_iswhite

Kernel provides isspace().

Cc: Andreas Dilger <andreas.dilger@intel.com>
Cc: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarPeng Tao <bergwolf@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 31fb613a
...@@ -90,21 +90,6 @@ struct cfs_expr_list { ...@@ -90,21 +90,6 @@ struct cfs_expr_list {
struct list_head el_exprs; 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); char *cfs_trimwhite(char *str);
int cfs_gettok(struct cfs_lstr *next, char delim, struct cfs_lstr *res); int cfs_gettok(struct cfs_lstr *next, char delim, struct cfs_lstr *res);
int cfs_str2num_check(char *str, int nob, unsigned *num, int cfs_str2num_check(char *str, int nob, unsigned *num,
......
...@@ -443,7 +443,7 @@ lnet_str2tbs_sep(struct list_head *tbs, char *str) ...@@ -443,7 +443,7 @@ lnet_str2tbs_sep(struct list_head *tbs, char *str)
/* Split 'str' into separate commands */ /* Split 'str' into separate commands */
for (;;) { for (;;) {
/* skip leading whitespace */ /* skip leading whitespace */
while (cfs_iswhite(*str)) while (isspace(*str))
str++; str++;
/* scan for separator or comment */ /* scan for separator or comment */
...@@ -460,7 +460,7 @@ lnet_str2tbs_sep(struct list_head *tbs, char *str) ...@@ -460,7 +460,7 @@ lnet_str2tbs_sep(struct list_head *tbs, char *str)
} }
for (i = 0; i < nob; i++) for (i = 0; i < nob; i++)
if (cfs_iswhite(str[i])) if (isspace(str[i]))
ltb->ltb_text[i] = ' '; ltb->ltb_text[i] = ' ';
else else
ltb->ltb_text[i] = str[i]; ltb->ltb_text[i] = str[i];
...@@ -667,7 +667,7 @@ lnet_parse_route(char *str, int *im_a_router) ...@@ -667,7 +667,7 @@ lnet_parse_route(char *str, int *im_a_router)
sep = str; sep = str;
for (;;) { for (;;) {
/* scan for token start */ /* scan for token start */
while (cfs_iswhite(*sep)) while (isspace(*sep))
sep++; sep++;
if (*sep == 0) { if (*sep == 0) {
if (ntokens < (got_hops ? 3 : 2)) if (ntokens < (got_hops ? 3 : 2))
...@@ -679,7 +679,7 @@ lnet_parse_route(char *str, int *im_a_router) ...@@ -679,7 +679,7 @@ lnet_parse_route(char *str, int *im_a_router)
token = sep++; token = sep++;
/* scan for token end */ /* scan for token end */
while (*sep != 0 && !cfs_iswhite(*sep)) while (*sep != 0 && !isspace(*sep))
sep++; sep++;
if (*sep != 0) if (*sep != 0)
*sep++ = 0; *sep++ = 0;
...@@ -858,7 +858,7 @@ lnet_match_network_tokens(char *net_entry, __u32 *ipaddrs, int nip) ...@@ -858,7 +858,7 @@ lnet_match_network_tokens(char *net_entry, __u32 *ipaddrs, int nip)
sep = tokens; sep = tokens;
for (;;) { for (;;) {
/* scan for token start */ /* scan for token start */
while (cfs_iswhite(*sep)) while (isspace(*sep))
sep++; sep++;
if (*sep == 0) if (*sep == 0)
break; break;
...@@ -866,7 +866,7 @@ lnet_match_network_tokens(char *net_entry, __u32 *ipaddrs, int nip) ...@@ -866,7 +866,7 @@ lnet_match_network_tokens(char *net_entry, __u32 *ipaddrs, int nip)
token = sep++; token = sep++;
/* scan for token end */ /* scan for token end */
while (*sep != 0 && !cfs_iswhite(*sep)) while (*sep != 0 && !isspace(*sep))
sep++; sep++;
if (*sep != 0) if (*sep != 0)
*sep++ = 0; *sep++ = 0;
......
...@@ -143,12 +143,12 @@ cfs_trimwhite(char *str) ...@@ -143,12 +143,12 @@ cfs_trimwhite(char *str)
{ {
char *end; char *end;
while (cfs_iswhite(*str)) while (isspace(*str))
str++; str++;
end = str + strlen(str); end = str + strlen(str);
while (end > str) { while (end > str) {
if (!cfs_iswhite(end[-1])) if (!isspace(end[-1]))
break; break;
end--; end--;
} }
...@@ -178,7 +178,7 @@ cfs_gettok(struct cfs_lstr *next, char delim, struct cfs_lstr *res) ...@@ -178,7 +178,7 @@ cfs_gettok(struct cfs_lstr *next, char delim, struct cfs_lstr *res)
/* skip leading white spaces */ /* skip leading white spaces */
while (next->ls_len) { while (next->ls_len) {
if (!cfs_iswhite(*next->ls_str)) if (!isspace(*next->ls_str))
break; break;
next->ls_str++; next->ls_str++;
next->ls_len--; next->ls_len--;
...@@ -205,7 +205,7 @@ cfs_gettok(struct cfs_lstr *next, char delim, struct cfs_lstr *res) ...@@ -205,7 +205,7 @@ cfs_gettok(struct cfs_lstr *next, char delim, struct cfs_lstr *res)
/* skip ending whitespaces */ /* skip ending whitespaces */
while (--end != res->ls_str) { while (--end != res->ls_str) {
if (!cfs_iswhite(*end)) if (!isspace(*end))
break; break;
} }
...@@ -234,7 +234,7 @@ cfs_str2num_check(char *str, int nob, unsigned *num, ...@@ -234,7 +234,7 @@ cfs_str2num_check(char *str, int nob, unsigned *num,
return 0; return 0;
for (; endp < str + nob; endp++) { for (; endp < str + nob; endp++) {
if (!cfs_iswhite(*endp)) if (!isspace(*endp))
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment