Commit c4dbf1de authored by Linus Torvalds's avatar Linus Torvalds

strtok -> strsep fixes

parent bcbcfa85
...@@ -66,9 +66,9 @@ static int devpts_parse_options(char *options, struct devpts_sb_info *sbi) ...@@ -66,9 +66,9 @@ static int devpts_parse_options(char *options, struct devpts_sb_info *sbi)
char *this_char, *value; char *this_char, *value;
this_char = NULL; this_char = NULL;
if ( options ) while ((this_char = strsep(&options, ",")) != NULL) {
this_char = strtok(options,","); if (!*this_char)
for ( ; this_char; this_char = strtok(NULL,",")) { continue;
if ((value = strchr(this_char,'=')) != NULL) if ((value = strchr(this_char,'=')) != NULL)
*value++ = 0; *value++ = 0;
if (!strcmp(this_char,"uid")) { if (!strcmp(this_char,"uid")) {
......
...@@ -221,9 +221,9 @@ static int parse_options (char * options, unsigned long * sb_block, ...@@ -221,9 +221,9 @@ static int parse_options (char * options, unsigned long * sb_block,
if (!options) if (!options)
return 1; return 1;
for (this_char = strtok (options, ","); while ((this_char = strsep (&options, ",")) != NULL) {
this_char != NULL; if (!*this_char)
this_char = strtok (NULL, ",")) { continue;
if ((value = strchr (this_char, '=')) != NULL) if ((value = strchr (this_char, '=')) != NULL)
*value++ = 0; *value++ = 0;
if (!strcmp (this_char, "bsddf")) if (!strcmp (this_char, "bsddf"))
......
...@@ -554,9 +554,9 @@ static int parse_options (char * options, unsigned long * sb_block, ...@@ -554,9 +554,9 @@ static int parse_options (char * options, unsigned long * sb_block,
if (!options) if (!options)
return 1; return 1;
for (this_char = strtok (options, ","); while ((this_char = strsep (&options, ",")) != NULL) {
this_char != NULL; if (!*this_char)
this_char = strtok (NULL, ",")) { continue;
if ((value = strchr (this_char, '=')) != NULL) if ((value = strchr (this_char, '=')) != NULL)
*value++ = 0; *value++ = 0;
if (!strcmp (this_char, "bsddf")) if (!strcmp (this_char, "bsddf"))
......
...@@ -224,8 +224,9 @@ static int parse_options(char *options, int *debug, ...@@ -224,8 +224,9 @@ static int parse_options(char *options, int *debug,
goto out; goto out;
save = 0; save = 0;
savep = NULL; savep = NULL;
for (this_char = strtok(options,","); this_char; while ((this_char = strsep(&options,",")) != NULL) {
this_char = strtok(NULL,",")) { if (!*this_char)
continue;
if ((value = strchr(this_char,'=')) != NULL) { if ((value = strchr(this_char,'=')) != NULL) {
save = *value; save = *value;
savep = value; savep = value;
......
...@@ -120,12 +120,12 @@ static char *presto_options(char *options, char *cache_data, ...@@ -120,12 +120,12 @@ static char *presto_options(char *options, char *cache_data,
store_opt(prestodev, NULL, PRESTO_PSDEV_NAME "0"); store_opt(prestodev, NULL, PRESTO_PSDEV_NAME "0");
CDEBUG(D_SUPER, "parsing options\n"); CDEBUG(D_SUPER, "parsing options\n");
for (this_char = strtok (options, ","); while ((this_char = strsep (&options, ",")) != NULL) {
this_char != NULL;
this_char = strtok (NULL, ",")) {
char *opt; char *opt;
CDEBUG(D_SUPER, "this_char %s\n", this_char); CDEBUG(D_SUPER, "this_char %s\n", this_char);
if (!*this_char)
continue;
if ( (opt = read_opt("fileset", this_char)) ) { if ( (opt = read_opt("fileset", this_char)) ) {
store_opt(fileset, opt, NULL); store_opt(fileset, opt, NULL);
continue; continue;
......
...@@ -202,8 +202,9 @@ static void __init root_nfs_parse(char *name, char *buf) ...@@ -202,8 +202,9 @@ static void __init root_nfs_parse(char *name, char *buf)
if ((options = strchr(name, ','))) { if ((options = strchr(name, ','))) {
*options++ = 0; *options++ = 0;
cp = strtok(options, ","); while ((cp = strsep(&options, ",")) != NULL) {
while (cp) { if (!*cp)
continue;
if ((val = strchr(cp, '='))) { if ((val = strchr(cp, '='))) {
struct nfs_int_opts *opts = root_int_opts; struct nfs_int_opts *opts = root_int_opts;
*val++ = '\0'; *val++ = '\0';
...@@ -220,7 +221,6 @@ static void __init root_nfs_parse(char *name, char *buf) ...@@ -220,7 +221,6 @@ static void __init root_nfs_parse(char *name, char *buf)
nfs_data.flags |= opts->or_mask; nfs_data.flags |= opts->or_mask;
} }
} }
cp = strtok(NULL, ",");
} }
} }
if (name[0] && strcmp(name, "default")) { if (name[0] && strcmp(name, "default")) {
......
...@@ -133,8 +133,11 @@ static int parse_options(char *options,uid_t *uid,gid_t *gid) ...@@ -133,8 +133,11 @@ static int parse_options(char *options,uid_t *uid,gid_t *gid)
*uid = current->uid; *uid = current->uid;
*gid = current->gid; *gid = current->gid;
if (!options) return 1; if (!options)
for (this_char = strtok(options,","); this_char; this_char = strtok(NULL,",")) { return 1;
while ((this_char = strsep(&options,",")) != NULL) {
if (!*this_char)
continue;
if ((value = strchr(this_char,'=')) != NULL) if ((value = strchr(this_char,'=')) != NULL)
*value++ = 0; *value++ = 0;
if (!strcmp(this_char,"uid")) { if (!strcmp(this_char,"uid")) {
......
...@@ -286,8 +286,9 @@ udf_parse_options(char *options, struct udf_options *uopt) ...@@ -286,8 +286,9 @@ udf_parse_options(char *options, struct udf_options *uopt)
if (!options) if (!options)
return 1; return 1;
for (opt = strtok(options, ","); opt; opt = strtok(NULL, ",")) while ((opt = strsep(&options, ",") != NULL) {
{ if (!*opt)
continue;
/* Make "opt=val" into two strings */ /* Make "opt=val" into two strings */
val = strchr(opt, '='); val = strchr(opt, '=');
if (val) if (val)
......
...@@ -258,10 +258,9 @@ static int ufs_parse_options (char * options, unsigned * mount_options) ...@@ -258,10 +258,9 @@ static int ufs_parse_options (char * options, unsigned * mount_options)
if (!options) if (!options)
return 1; return 1;
for (this_char = strtok (options, ","); while ((this_char = strsep (&options, ",")) != NULL) {
this_char != NULL; if (!*this_char)
this_char = strtok (NULL, ",")) { continue;
if ((value = strchr (this_char, '=')) != NULL) if ((value = strchr (this_char, '=')) != NULL)
*value++ = 0; *value++ = 0;
if (!strcmp (this_char, "ufstype")) { if (!strcmp (this_char, "ufstype")) {
......
...@@ -115,7 +115,9 @@ static int parse_options(char *options, struct fat_mount_options *opts) ...@@ -115,7 +115,9 @@ static int parse_options(char *options, struct fat_mount_options *opts)
save = 0; save = 0;
savep = NULL; savep = NULL;
ret = 1; ret = 1;
for (this_char = strtok(options,","); this_char; this_char = strtok(NULL,",")) { while ((this_char = strsep(&options,",")) != NULL) {
if (!*this_char)
continue;
if ((value = strchr(this_char,'=')) != NULL) { if ((value = strchr(this_char,'=')) != NULL) {
save = *value; save = *value;
savep = value; savep = value;
......
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