]> git.hungrycats.org Git - linux/commitdiff
strtok -> strsep fixes
authorLinus Torvalds <torvalds@penguin.transmeta.com>
Wed, 3 Apr 2002 06:00:03 +0000 (22:00 -0800)
committerLinus Torvalds <torvalds@penguin.transmeta.com>
Wed, 3 Apr 2002 06:00:03 +0000 (22:00 -0800)
fs/devpts/inode.c
fs/ext2/super.c
fs/ext3/super.c
fs/fat/inode.c
fs/intermezzo/super.c
fs/nfs/nfsroot.c
fs/proc/inode.c
fs/udf/super.c
fs/ufs/super.c
fs/vfat/namei.c

index ce8f545fb8a59d66ba6c961ffb01dd32efdde331..231bc91cd79d59694527ebaf607c11b831e0650b 100644 (file)
@@ -66,9 +66,9 @@ static int devpts_parse_options(char *options, struct devpts_sb_info *sbi)
        char *this_char, *value;
 
        this_char = NULL;
-       if ( options )
-               this_char = strtok(options,",");
-       for ( ; this_char; this_char = strtok(NULL,",")) {
+       while ((this_char = strsep(&options, ",")) != NULL) {
+               if (!*this_char)
+                       continue;
                if ((value = strchr(this_char,'=')) != NULL)
                        *value++ = 0;
                if (!strcmp(this_char,"uid")) {
index e3f8ec62c1cb84888ae824a33d52e0ba29d4dff9..d4fcb94cac45802a47d849a7d48d0d4ef17c63af 100644 (file)
@@ -221,9 +221,9 @@ static int parse_options (char * options, unsigned long * sb_block,
 
        if (!options)
                return 1;
-       for (this_char = strtok (options, ",");
-            this_char != NULL;
-            this_char = strtok (NULL, ",")) {
+       while ((this_char = strsep (&options, ",")) != NULL) {
+               if (!*this_char)
+                       continue;
                if ((value = strchr (this_char, '=')) != NULL)
                        *value++ = 0;
                if (!strcmp (this_char, "bsddf"))
index 7b5d962906859c4276d4039c9594f98e23964d9e..8f1f16623b0a5542b5c911f5a1693df9feb21fa8 100644 (file)
@@ -554,9 +554,9 @@ static int parse_options (char * options, unsigned long * sb_block,
 
        if (!options)
                return 1;
-       for (this_char = strtok (options, ",");
-            this_char != NULL;
-            this_char = strtok (NULL, ",")) {
+       while ((this_char = strsep (&options, ",")) != NULL) {
+               if (!*this_char)
+                       continue;
                if ((value = strchr (this_char, '=')) != NULL)
                        *value++ = 0;
                if (!strcmp (this_char, "bsddf"))
index 35b98b7343cef5eabe2ed5bd25675642b532e0e1..b5f9f42273958145e38bf50a036f811b2ca2c46a 100644 (file)
@@ -224,8 +224,9 @@ static int parse_options(char *options, int *debug,
                goto out;
        save = 0;
        savep = NULL;
-       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) {
                        save = *value;
                        savep = value;
index de9d181359dcfe9e33bd677e5edb5d789f7e8a07..4a9358f82c07a12c17a0846572d54d4bd2b9ec7e 100644 (file)
@@ -120,12 +120,12 @@ static char *presto_options(char *options, char *cache_data,
         store_opt(prestodev, NULL, PRESTO_PSDEV_NAME "0"); 
 
         CDEBUG(D_SUPER, "parsing options\n");
-        for (this_char = strtok (options, ",");
-             this_char != NULL;
-             this_char = strtok (NULL, ",")) {
+        while ((this_char = strsep (&options, ",")) != NULL) {
                 char *opt;
                 CDEBUG(D_SUPER, "this_char %s\n", this_char);
 
+               if (!*this_char)
+                       continue;
                 if ( (opt = read_opt("fileset", this_char)) ) {
                         store_opt(fileset, opt, NULL);
                         continue;
index 5541efe6ee2a1fa82e9b6ff4fec7ce2effbd1ea2..0bd4a72ed9b69c0d7183d81d58b83443cb0d3c82 100644 (file)
@@ -202,8 +202,9 @@ static void __init root_nfs_parse(char *name, char *buf)
 
        if ((options = strchr(name, ','))) {
                *options++ = 0;
-               cp = strtok(options, ",");
-               while (cp) {
+               while ((cp = strsep(&options, ",")) != NULL) {
+                       if (!*cp)
+                               continue;
                        if ((val = strchr(cp, '='))) {
                                struct nfs_int_opts *opts = root_int_opts;
                                *val++ = '\0';
@@ -220,7 +221,6 @@ static void __init root_nfs_parse(char *name, char *buf)
                                        nfs_data.flags |= opts->or_mask;
                                }
                        }
-                       cp = strtok(NULL, ",");
                }
        }
        if (name[0] && strcmp(name, "default")) {
index 4ae60bfb88fb4dda6ddeaf6446dfc3a999269692..638d218a7f15df081e521b98ff460185d72dfee9 100644 (file)
@@ -133,8 +133,11 @@ static int parse_options(char *options,uid_t *uid,gid_t *gid)
 
        *uid = current->uid;
        *gid = current->gid;
-       if (!options) return 1;
-       for (this_char = strtok(options,","); this_char; this_char = strtok(NULL,",")) {
+       if (!options)
+               return 1;
+       while ((this_char = strsep(&options,",")) != NULL) {
+               if (!*this_char)
+                       continue;
                if ((value = strchr(this_char,'=')) != NULL)
                        *value++ = 0;
                if (!strcmp(this_char,"uid")) {
index 2edd4015fb61c90a7d8bf843a72073e0df159f32..dd5c7177a1318c279f8baaa19599816696a8f266 100644 (file)
@@ -286,8 +286,9 @@ udf_parse_options(char *options, struct udf_options *uopt)
        if (!options)
                return 1;
 
-       for (opt = strtok(options, ","); opt; opt = strtok(NULL, ","))
-       {
+       while ((opt = strsep(&options, ",") != NULL) {
+               if (!*opt)
+                       continue;
                /* Make "opt=val" into two strings */
                val = strchr(opt, '=');
                if (val)
index c2cd329064b37617e0c2c652a61bb702be9aaed2..e13ce227d0bf1d9919c5d747eada1dbb0e869878 100644 (file)
@@ -257,11 +257,10 @@ static int ufs_parse_options (char * options, unsigned * mount_options)
        
        if (!options)
                return 1;
-               
-       for (this_char = strtok (options, ",");
-            this_char != NULL;
-            this_char = strtok (NULL, ",")) {
-            
+
+       while ((this_char = strsep (&options, ",")) != NULL) {
+               if (!*this_char)
+                       continue;
                if ((value = strchr (this_char, '=')) != NULL)
                        *value++ = 0;
                if (!strcmp (this_char, "ufstype")) {
index e44b87116be1e316f2357ca89f255369d19481e4..c71cf4971f46b66fd2add5276211da3a258fb09a 100644 (file)
@@ -115,7 +115,9 @@ static int parse_options(char *options,     struct fat_mount_options *opts)
        save = 0;
        savep = NULL;
        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) {
                        save = *value;
                        savep = value;