Skip to contentSkip to conversation

strtok --> strsep in framebuffer drivers

PATCH René Scharfe 2 participants 4 messages Oct 25, 2001 – Oct 27, 2001 1 message not in the archive

Subsystems (14)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Am Donnerstag, 25. Oktober 2001 08:58 schrieben Sie:

Quoted 10 lines

In article <[email protected]> you write:

Review

Quoted 2 lines
(quoted diff) +1 -1
-	for (opt = strtok(options, ","); opt; opt = strtok(NULL, ",")) {
+	while (opt = strsep(&options, ",")) {

Btw, this causes gcc to warn all over the place about "assignment used as truth value".

It's valid C, but it's also a very common (and often valid) warning..

Linus

Yes. I assumed my compiler (gcc 2.96) was misbehaving by reporting all that warnings about code which is actually just some normal C code. But after some consideration I see that it can help greatly in case of typos and so on.

And because of that I'm actually paying for a round of pairs of parentheses to make all those warnings go away. Following patch compiles here, but is untested. It requires my previous 3 patches on that subject (one of which went into kernel 2.4.13-pre6).

René

diff -ruN linux-2.4.13-rs/drivers/video/acornfb.c
linux-2.4.13-rs2/drivers/video/acornfb.c

drivers/video/acornfb.c +1 -1
@@ -1528,7 +1528,7 @@
 
 	acornfb_init_fbinfo();
 
-	while (opt = strsep(&options, ",")) {
+	while ((opt = strsep(&options, ","))) {
 		if (!*opt)
 			continue;
 

diff -ruN linux-2.4.13-rs/drivers/video/amifb.c
linux-2.4.13-rs2/drivers/video/amifb.c

drivers/video/amifb.c +1 -1
@@ -1192,7 +1192,7 @@
 	if (!options || !*options)
 		return 0;
 
-	while (this_opt = strsep(&options, ",")) {
+	while ((this_opt = strsep(&options, ","))) {
 		if (!*this_opt)
 			continue;
 		if (!strcmp(this_opt, "inverse")) {

diff -ruN linux-2.4.13-rs/drivers/video/atafb.c
linux-2.4.13-rs2/drivers/video/atafb.c

drivers/video/atafb.c +1 -1
@@ -2899,7 +2899,7 @@
     if (!options || !*options)
 		return 0;
      
-    while (this_opt = strsep(&options, ",")) {
+    while ((this_opt = strsep(&options, ","))) {
 	if (!*this_opt) continue;
 	if ((temp=get_video_mode(this_opt)))
 		default_par=temp;

diff -ruN linux-2.4.13-rs/drivers/video/aty/atyfb_base.c linux-2.4.13-rs2/drivers/video/aty/atyfb_base.c

drivers/video/aty/atyfb_base.c +1 -1
@@ -2521,7 +2521,7 @@
     if (!options || !*options)
 	return 0;
 
-    while (this_opt = strsep(&options, ",")) {
+    while ((this_opt = strsep(&options, ","))) {
 	if (!*this_opt)
 		continue;
 	if (!strncmp(this_opt, "font:", 5)) {

diff -ruN linux-2.4.13-rs/drivers/video/aty128fb.c linux-2.4.13-rs2/drivers/video/aty128fb.c

drivers/video/aty128fb.c +1 -1
@@ -1613,7 +1613,7 @@
     if (!options || !*options)
 	return 0;
 
-    while (this_opt = strsep(&options, ",")) {
+    while ((this_opt = strsep(&options, ","))) {
 	if (!*this_opt)
 	    continue;
 	if (!strncmp(this_opt, "font:", 5)) {

diff -ruN linux-2.4.13-rs/drivers/video/clgenfb.c
linux-2.4.13-rs2/drivers/video/clgenfb.c

drivers/video/clgenfb.c +1 -1
@@ -2817,7 +2817,7 @@
 	if (!options || !*options)
 		return 0;
 
-	while (this_opt = strsep (&options, ",")) {
+	while ((this_opt = strsep (&options, ","))) {
 		if (!*this_opt) continue;
 
 		DPRINTK("clgenfb_setup: option '%s'\n", this_opt);

diff -ruN linux-2.4.13-rs/drivers/video/controlfb.c linux-2.4.13-rs2/drivers/video/controlfb.c

drivers/video/controlfb.c +1 -1
@@ -1423,7 +1423,7 @@
 	if (!options || !*options)
 		return;
 
-	while (this_opt = strsep(&options, ",")) {
+	while ((this_opt = strsep(&options, ","))) {
 		if (!strncmp(this_opt, "font:", 5)) {
 			char *p;
 			int i;

diff -ruN linux-2.4.13-rs/drivers/video/cyberfb.c
linux-2.4.13-rs2/drivers/video/cyberfb.c

drivers/video/cyberfb.c +1 -1
@@ -1022,7 +1022,7 @@
 		return 0;
 	}
 
-	while (this_opt = strsep(&options, ",")) {
+	while ((this_opt = strsep(&options, ","))) {
 		if (!*this_opt)
 			continue;
 		if (!strcmp(this_opt, "inverse")) {

diff -ruN linux-2.4.13-rs/drivers/video/fm2fb.c
linux-2.4.13-rs2/drivers/video/fm2fb.c

drivers/video/fm2fb.c +1 -1
@@ -430,7 +430,7 @@
     if (!options || !*options)
 	return 0;
 
-    while (this_opt = strsep(&options, ",")) {
+    while ((this_opt = strsep(&options, ","))) {
 	if (!strncmp(this_opt, "pal", 3))
 	    fm2fb_mode = FM2FB_MODE_PAL;
 	else if (!strncmp(this_opt, "ntsc", 4))

diff -ruN linux-2.4.13-rs/drivers/video/hgafb.c
linux-2.4.13-rs2/drivers/video/hgafb.c

drivers/video/hgafb.c +1 -1
@@ -795,7 +795,7 @@
 	if (!options || !*options)
 		return 0;
 
-	while (this_opt = strsep(&options, ",")) {
+	while ((this_opt = strsep(&options, ","))) {
 		if (!strncmp(this_opt, "font:", 5))
 			strcpy(fb_info.fontname, this_opt+5);
 	}

diff -ruN linux-2.4.13-rs/drivers/video/igafb.c
linux-2.4.13-rs2/drivers/video/igafb.c

drivers/video/igafb.c +1 -1
@@ -773,7 +773,7 @@
     if (!options || !*options)
         return 0;
 
-    while (this_opt = strsep(&options, ",")) {
+    while ((this_opt = strsep(&options, ","))) {
         if (!strncmp(this_opt, "font:", 5)) {
                 char *p;
                 int i;

diff -ruN linux-2.4.13-rs/drivers/video/imsttfb.c
linux-2.4.13-rs2/drivers/video/imsttfb.c

drivers/video/imsttfb.c +1 -1
@@ -1977,7 +1977,7 @@
 	if (!options || !*options)
 		return 0;
 
-	while (this_opt = strsep(&options, ",")) {
+	while ((this_opt = strsep(&options, ","))) {
 		if (!strncmp(this_opt, "font:", 5)) {
 			char *p;
 			int i;

diff -ruN linux-2.4.13-rs/drivers/video/macfb.c
linux-2.4.13-rs2/drivers/video/macfb.c

drivers/video/macfb.c +1 -1
@@ -848,7 +848,7 @@
 	if (!options || !*options)
 		return;
 	
-	while (this_opt = strsep(&options, ",")) {
+	while ((this_opt = strsep(&options, ","))) {
 		if (!*this_opt) continue;
 		
 		if (! strcmp(this_opt, "inverse"))

diff -ruN linux-2.4.13-rs/drivers/video/matrox/matroxfb_base.c linux-2.4.13-rs2/drivers/video/matrox/matroxfb_base.c
--- linux-2.4.13-rs/drivers/video/matrox/matroxfb_base.c Wed Oct 24 19:19:04
2001
+++ linux-2.4.13-rs2/drivers/video/matrox/matroxfb_base.c Thu Oct 25 22:41:21
2001
@@ -2355,7 +2355,7 @@
if (!options || !*options)
return 0;

- while (this_opt = strsep(&options, ",")) {
+ while ((this_opt = strsep(&options, ","))) {
if (!*this_opt) continue;

dprintk("matroxfb_setup: option %s\n", this_opt);
diff -ruN linux-2.4.13-rs/drivers/video/platinumfb.c linux-2.4.13-rs2/drivers/video/platinumfb.c

drivers/video/platinumfb.c +1 -1
@@ -841,7 +841,7 @@
 	if (!options || !*options)
 		return 0;
 
-	while (this_opt = strsep(&options, ",")) {
+	while ((this_opt = strsep(&options, ","))) {
 		if (!strncmp(this_opt, "font:", 5)) {
 			char *p;
 			int i;

diff -ruN linux-2.4.13-rs/drivers/video/radeonfb.c linux-2.4.13-rs2/drivers/video/radeonfb.c

drivers/video/radeonfb.c +1 -1
@@ -537,7 +537,7 @@
         if (!options || !*options)
                 return 0;
  
-	while (this_opt = strsep (&options, ",")) {
+	while ((this_opt = strsep (&options, ","))) {
 		if (!*this_opt)
 			continue;
                 if (!strncmp (this_opt, "font:", 5)) {

diff -ruN linux-2.4.13-rs/drivers/video/retz3fb.c
linux-2.4.13-rs2/drivers/video/retz3fb.c

drivers/video/retz3fb.c +1 -1
@@ -1348,7 +1348,7 @@
 	if (!options || !*options)
 		return 0;
 
-	while (this_opt = strsep(&options, ",")) {
+	while ((this_opt = strsep(&options, ","))) {
 		if (!*this_opt)
 			continue;
 		if (!strcmp(this_opt, "inverse")) {

diff -ruN linux-2.4.13-rs/drivers/video/riva/fbdev.c linux-2.4.13-rs2/drivers/video/riva/fbdev.c

drivers/video/riva/fbdev.c +1 -1
@@ -2045,7 +2045,7 @@
 	if (!options || !*options)
 		return 0;
 
-	while (this_opt = strsep(&options, ",")) {
+	while ((this_opt = strsep(&options, ","))) {
 		if (!*this_opt)
 			continue;
 		if (!strncmp(this_opt, "font:", 5)) {

diff -ruN linux-2.4.13-rs/drivers/video/sa1100fb.c linux-2.4.13-rs2/drivers/video/sa1100fb.c

drivers/video/sa1100fb.c +1 -1
@@ -2299,7 +2299,7 @@
 	if (!options || !*options)
 		return 0;
 
-	while (this_opt = strsep(&options, ",")) {
+	while ((this_opt = strsep(&options, ","))) {
 
 		if (!strncmp(this_opt, "bpp:", 4))
 			current_par.max_bpp =

diff -ruN linux-2.4.13-rs/drivers/video/sgivwfb.c
linux-2.4.13-rs2/drivers/video/sgivwfb.c

drivers/video/sgivwfb.c +1 -1
@@ -862,7 +862,7 @@
   if (!options || !*options)
     return 0;
 
-  while (this_opt = strsep(&options, ",")) {
+  while ((this_opt = strsep(&options, ","))) {
     if (!strncmp(this_opt, "font:", 5))
       strcpy(fb_info.fontname, this_opt+5);
   }

diff -ruN linux-2.4.13-rs/drivers/video/sis/sis_main.c linux-2.4.13-rs2/drivers/video/sis/sis_main.c

drivers/video/sis/sis_main.c +1 -1
@@ -1726,7 +1726,7 @@
 	if (!options || !*options)
 		return 0;
 
-	while (this_opt = strsep(&options, ",")) {
+	while ((this_opt = strsep(&options, ","))) {
 		if (!*this_opt)
 			continue;
 

diff -ruN linux-2.4.13-rs/drivers/video/sstfb.c
linux-2.4.13-rs2/drivers/video/sstfb.c

drivers/video/sstfb.c +1 -1
@@ -1697,7 +1697,7 @@
 	if (!options || !*options)
 		return 0;
 
-	while (this_opt = strsep(&options, ",")) {
+	while ((this_opt = strsep(&options, ","))) {
 		if (!*this_opt) continue;
 
 		f_ddprintk("option %s\n", this_opt);

diff -ruN linux-2.4.13-rs/drivers/video/tdfxfb.c
linux-2.4.13-rs2/drivers/video/tdfxfb.c

drivers/video/tdfxfb.c +1 -1
@@ -2086,7 +2086,7 @@
   if(!options || !*options)
     return;
 
-  while(this_opt = strsep(&options, ",")) {
+  while((this_opt = strsep(&options, ","))) {
     if(!*this_opt)
       continue;
     if(!strcmp(this_opt, "inverse")) {

diff -ruN linux-2.4.13-rs/drivers/video/tgafb.c
linux-2.4.13-rs2/drivers/video/tgafb.c

drivers/video/tgafb.c +1 -1
@@ -889,7 +889,7 @@
     int i;
     
     if (options && *options) {
-    	while (this_opt = strsep(&options, ",")) {
+    	while ((this_opt = strsep(&options, ","))) {
        	    if (!*this_opt) { continue; }
         
 	    if (!strncmp(this_opt, "font:", 5)) {

diff -ruN linux-2.4.13-rs/drivers/video/valkyriefb.c linux-2.4.13-rs2/drivers/video/valkyriefb.c

drivers/video/valkyriefb.c +1 -1
@@ -801,7 +801,7 @@
 	if (!options || !*options)
 		return 0;
 
-	while (this_opt = strsep(&options, ",")) {
+	while ((this_opt = strsep(&options, ","))) {
 		if (!strncmp(this_opt, "font:", 5)) {
 			char *p;
 			int i;

diff -ruN linux-2.4.13-rs/drivers/video/vesafb.c
linux-2.4.13-rs2/drivers/video/vesafb.c

drivers/video/vesafb.c +1 -1
@@ -457,7 +457,7 @@
 	if (!options || !*options)
 		return 0;
 	
-	while (this_opt = strsep(&options, ",")) {
+	while ((this_opt = strsep(&options, ","))) {
 		if (!*this_opt) continue;
 		
 		if (! strcmp(this_opt, "inverse"))

diff -ruN linux-2.4.13-rs/drivers/video/vfb.c
linux-2.4.13-rs2/drivers/video/vfb.c

drivers/video/vfb.c +1 -1
@@ -382,7 +382,7 @@
     if (!options || !*options)
 	return 0;
 
-    while (this_opt = strsep(&options, ",")) {
+    while ((this_opt = strsep(&options, ","))) {
 	if (!strncmp(this_opt, "font:", 5))
 	    strcpy(fb_info.fontname, this_opt+5);
     }

diff -ruN linux-2.4.13-rs/drivers/video/vga16fb.c
linux-2.4.13-rs2/drivers/video/vga16fb.c

drivers/video/vga16fb.c +1 -1
@@ -692,7 +692,7 @@
 	if (!options || !*options)
 		return 0;
 	
-	while (this_opt = strsep(&options, ",")) {
+	while ((this_opt = strsep(&options, ","))) {
 		if (!*this_opt) continue;
 		
 		if (!strncmp(this_opt, "font:", 5))

diff -ruN linux-2.4.13-rs/drivers/video/virgefb.c
linux-2.4.13-rs2/drivers/video/virgefb.c

drivers/video/virgefb.c +1 -1
@@ -1085,7 +1085,7 @@
 	if (!options || !*options)
 		return 0;
 
-	while (this_opt = strsep(&options, ",")) {
+	while ((this_opt = strsep(&options, ","))) {
 		if (!*this_opt)
 			continue;
 		if (!strcmp(this_opt, "inverse")) {
fs/adfs/super.c +1 -1
diff -ruN linux-2.4.13-rs/fs/adfs/super.c linux-2.4.13-rs2/fs/adfs/super.c
@@ -171,7 +171,7 @@
 	if (!options)
 		return 0;
 
-	while (opt = strsep(&options, ",")) {
+	while ((opt = strsep(&options, ","))) {
 		if (!*opt)
 			continue;
 		value = strchr(opt, '=');
fs/affs/super.c +1 -1
diff -ruN linux-2.4.13-rs/fs/affs/super.c linux-2.4.13-rs2/fs/affs/super.c
@@ -109,7 +109,7 @@
 	*mount_opts = 0;
 	if (!options)
 		return 1;
-	while (this_char = strsep(&options, ",")) {
+	while ((this_char = strsep(&options, ","))) {
 		if (!*this_char)
 			continue;
 		f = 0;
fs/autofs/inode.c +1 -1
diff -ruN linux-2.4.13-rs/fs/autofs/inode.c linux-2.4.13-rs2/fs/autofs/inode.c
@@ -60,7 +60,7 @@
 	*pipefd = -1;
 
 	if ( !options ) return 1;
-	while (this_char = strsep(&options,",")) {
+	while ((this_char = strsep(&options,","))) {
 		if (!*this_char)
 			continue;
 		if ((value = strchr(this_char,'=')) != NULL)

diff -ruN linux-2.4.13-rs/fs/autofs4/inode.c
linux-2.4.13-rs2/fs/autofs4/inode.c

fs/autofs4/inode.c +1 -1
@@ -112,7 +112,7 @@
 	*pipefd = -1;
 
 	if ( !options ) return 1;
-	while (this_char = strsep(&options,",")) {
+	while ((this_char = strsep(&options,","))) {
 		if (!*this_char)
 			continue;
 		if ((value = strchr(this_char,'=')) != NULL)
fs/devpts/inode.c +1 -1
diff -ruN linux-2.4.13-rs/fs/devpts/inode.c linux-2.4.13-rs2/fs/devpts/inode.c
@@ -68,7 +68,7 @@
 
 	if (!options)
 		goto default_settings;
-	while ( this_char = strsep(&options,",") ) {
+	while ( (this_char = strsep(&options,",")) ) {
 		if (!*this_char)
 			continue;
 		if ((value = strchr(this_char,'=')) != NULL)
fs/ext2/super.c +1 -1
diff -ruN linux-2.4.13-rs/fs/ext2/super.c linux-2.4.13-rs2/fs/ext2/super.c
@@ -166,7 +166,7 @@
 
 	if (!options)
 		return 1;
-	while (this_char = strsep (&options, ",")) {
+	while ((this_char = strsep (&options, ","))) {
 		if (!*this_char)
 			continue;
 		if ((value = strchr (this_char, '=')) != NULL)
fs/fat/inode.c +1 -1
diff -ruN linux-2.4.13-rs/fs/fat/inode.c linux-2.4.13-rs2/fs/fat/inode.c
@@ -230,7 +230,7 @@
 		goto out;
 	save = 0;
 	savep = NULL;
-	while (this_char = strsep(&options_p, ",")) {
+	while ((this_char = strsep(&options_p, ","))) {
 		if ((value = strchr(this_char,'=')) != NULL) {
 			save = *value;
 			savep = value;
fs/hfs/super.c +1 -1
diff -ruN linux-2.4.13-rs/fs/hfs/super.c linux-2.4.13-rs2/fs/hfs/super.c
@@ -181,7 +181,7 @@
 	if (!options) {
 		goto done;
 	}
-	while (this_char = strsep(&options, ",")) {
+	while ((this_char = strsep(&options, ","))) {
 		if (!*this_char)
 			continue;
 		if ((value = strchr(this_char,'=')) != NULL) {
fs/hpfs/super.c +1 -1
diff -ruN linux-2.4.13-rs/fs/hpfs/super.c linux-2.4.13-rs2/fs/hpfs/super.c
@@ -176,7 +176,7 @@
 
 	/*printk("Parsing opts: '%s'\n",opts);*/
 
-	while (p = strsep(&opts, ",")) {
+	while ((p = strsep(&opts, ","))) {
 		if (!*p)
 			continue;
 		if ((rhs = strchr(p, '=')) != 0)
fs/isofs/inode.c +1 -1
diff -ruN linux-2.4.13-rs/fs/isofs/inode.c linux-2.4.13-rs2/fs/isofs/inode.c
@@ -290,7 +290,7 @@
 	popt->session=-1;
 	popt->sbsector=-1;
 	if (!options) return 1;
-	while (this_char = strsep(&options,",")) {
+	while ((this_char = strsep(&options,","))) {
 		if (!*this_char)
 			continue;
 	        if (strncmp(this_char,"norock",6) == 0) {
fs/nfs/nfsroot.c +1 -1
diff -ruN linux-2.4.13-rs/fs/nfs/nfsroot.c linux-2.4.13-rs2/fs/nfs/nfsroot.c
@@ -202,7 +202,7 @@
 
 	if ((options = strchr(name, ','))) {
 		*options++ = 0;
-		while (cp = strsep(&options, ",")) {
+		while ((cp = strsep(&options, ","))) {
 			if (!*cp)
 				continue;
 			if ((val = strchr(cp, '='))) {
fs/ntfs/fs.c +1 -1
diff -ruN linux-2.4.13-rs/fs/ntfs/fs.c linux-2.4.13-rs2/fs/ntfs/fs.c
@@ -369,7 +369,7 @@
 
 	if (!opt)
 		goto done;
-	while (opt = strsep(&options, ",")) {
+	while ((opt = strsep(&options, ","))) {
 		if (!*opt)
 			continue;
 		if ((value = strchr(opt, '=')) != NULL)
fs/proc/inode.c +1 -1
diff -ruN linux-2.4.13-rs/fs/proc/inode.c linux-2.4.13-rs2/fs/proc/inode.c
@@ -106,7 +106,7 @@
 	*uid = current->uid;
 	*gid = current->gid;
 	if (!options) return 1;
-	while (this_char = strsep(&options,",")) {
+	while ((this_char = strsep(&options,","))) {
 		if (!*this_char)
 			continue;
 		if ((value = strchr(this_char,'=')) != NULL)

diff -ruN linux-2.4.13-rs/fs/reiserfs/super.c
linux-2.4.13-rs2/fs/reiserfs/super.c

fs/reiserfs/super.c +1 -1
@@ -144,7 +144,7 @@
 	/* use default configuration: create tails, journaling on, no
            conversion to newest format */
 	return 1;
-    while (this_char = strsep (&options, ",")) {
+    while ((this_char = strsep (&options, ","))) {
 	if (!*this_char)
 	    continue;
 	if ((value = strchr (this_char, '=')) != NULL)
fs/udf/super.c +1 -1
diff -ruN linux-2.4.13-rs/fs/udf/super.c linux-2.4.13-rs2/fs/udf/super.c
@@ -218,7 +218,7 @@
 	if (!options)
 		return 1;
 
-	while (opt = strsep(&options, ","))
+	while ((opt = strsep(&options, ",")))
 	{
 		if (!*opt)
 			continue;
fs/ufs/super.c +1 -1
diff -ruN linux-2.4.13-rs/fs/ufs/super.c linux-2.4.13-rs2/fs/ufs/super.c
@@ -257,7 +257,7 @@
 	if (!options)
 		return 1;
 		
-	while (this_char = strsep (&options, ",")) {
+	while ((this_char = strsep (&options, ","))) {
 		if (!*this_char)
 			continue;
 		if ((value = strchr (this_char, '=')) != NULL)
fs/vfat/namei.c +1 -1
diff -ruN linux-2.4.13-rs/fs/vfat/namei.c linux-2.4.13-rs2/fs/vfat/namei.c
@@ -121,7 +121,7 @@
 	save = 0;
 	savep = NULL;
 	ret = 1;
-	while (this_char = strsep(&options_p, ",")) {
+	while ((this_char = strsep(&options_p, ","))) {
 		if ((value = strchr(this_char,'=')) != NULL) {
 			save = *value;
 			savep = value;
mm/shmem.c +1 -1
diff -ruN linux-2.4.13-rs/mm/shmem.c linux-2.4.13-rs2/mm/shmem.c
@@ -1239,7 +1239,7 @@
 
 	if (!options)
 		return 0;
-	while (this_char = strsep(&options,",")) {
+	while ((this_char = strsep(&options,","))) {
 		if (!*this_char)
 			continue;
 		if ((value = strchr(this_char,'=')) != NULL) {
#2 lore raw
Quoted 5 lines · René Scharfe

Yes. I assumed my compiler (gcc 2.96) was misbehaving by reporting all that warnings about code which is actually just some normal C code. But after some consideration I see that it can help greatly in case of typos and so on.

Please use an explicit test - I know gcc suggest just an extra set of parenthesis, but I'm personally convinced that is just because some gcc people have been damaged by too much LISP.

I think

	if ((a = b))

looks nothing but stupid, while

	if ((a = b) != 0)

"explains" the parenthesis..

Linus

#3 lore raw

Am Freitag, 26. Oktober 2001 02:41 schrieben Sie:

Quoted 9 lines

I think

        if ((a = b))

looks nothing but stupid, while

        if ((a = b) != 0)

"explains" the parenthesis..

Agreed. Following patch is against kernel 2.4.14-pre2 and requires none of my previous patches. What it does:

* cures all remaining framebuffer and filesystem drivers (including shmfs, which lives in drivers/mm) from using strtok()

* remedies all those warnings regarding the usage of assignments in comparisions I introduced earlier

* contains a real bugfix! ;)

The bug was spotted by Roman Zippel (thanks!): in virgefb.c there is a '}' missing. My first patch, which went into 2.4.13, did that. hanks!).

I just hope it's not too big a patch. If so, at least apply the first chunk (that bugfix), please.

René

drivers/video/virgefb.c +4 -1
diff -ruN linux-2.4.14-pre2/drivers/video/virgefb.c linux-2.4.14-pre2-rs/drivers/video/virgefb.c
@@ -1085,7 +1085,9 @@
 	if (!options || !*options)
 		return 0;
 
-	while (this_opt = strsep(&options, ",")) {
+	while ((this_opt = strsep(&options, ",")) != NULL) {
+		if (!*this_opt)
+			continue;
 		if (!strcmp(this_opt, "inverse")) {
 			Cyberfb_inverse = 1;
 			fb_invert_cmaps();
@@ -1099,6 +1101,7 @@
 		}
 		else
 			get_video_mode(this_opt);
+	}
 
 	DPRINTK("default mode: xres=%d, yres=%d, bpp=%d\n",virgefb_default.xres,
                                                            virgefb_default.yres,
drivers/video/acornfb.c +1 -1
diff -ruN linux-2.4.14-pre2/drivers/video/acornfb.c linux-2.4.14-pre2-rs/drivers/video/acornfb.c
@@ -1528,7 +1528,7 @@
 
 	acornfb_init_fbinfo();
 
-	while (opt = strsep(&options, ",")) {
+	while ((opt = strsep(&options, ",")) != NULL) {
 		if (!*opt)
 			continue;
 
drivers/video/amifb.c +3 -1
diff -ruN linux-2.4.14-pre2/drivers/video/amifb.c linux-2.4.14-pre2-rs/drivers/video/amifb.c
@@ -1192,7 +1192,9 @@
 	if (!options || !*options)
 		return 0;
 
-	while (this_opt = strsep(&options, ",")) {
+	while ((this_opt = strsep(&options, ",")) != NULL) {
+		if (!*this_opt)
+			continue;
 		if (!strcmp(this_opt, "inverse")) {
 			amifb_inverse = 1;
 			fb_invert_cmaps();
drivers/video/atafb.c +1 -1
diff -ruN linux-2.4.14-pre2/drivers/video/atafb.c linux-2.4.14-pre2-rs/drivers/video/atafb.c
@@ -2899,7 +2899,7 @@
     if (!options || !*options)
 		return 0;
      
-    for(this_opt=strtok(options,","); this_opt; this_opt=strtok(NULL,",")) {
+    while ((this_opt = strsep(&options, ",")) != NULL) {
 	if (!*this_opt) continue;
 	if ((temp=get_video_mode(this_opt)))
 		default_par=temp;
drivers/video/aty/atyfb_base.c +3 -1
diff -ruN linux-2.4.14-pre2/drivers/video/aty/atyfb_base.c linux-2.4.14-pre2-rs/drivers/video/aty/atyfb_base.c
@@ -2521,7 +2521,9 @@
     if (!options || !*options)
 	return 0;
 
-    while (this_opt = strsep(&options, ",")) {
+    while ((this_opt = strsep(&options, ",")) != NULL) {
+	if (!*this_opt)
+		continue;
 	if (!strncmp(this_opt, "font:", 5)) {
 		char *p;
 		int i;
drivers/video/aty128fb.c +3 -1
diff -ruN linux-2.4.14-pre2/drivers/video/aty128fb.c linux-2.4.14-pre2-rs/drivers/video/aty128fb.c
@@ -1613,7 +1613,9 @@
     if (!options || !*options)
 	return 0;
 
-    while (this_opt = strsep(&options, ",")) {
+    while ((this_opt = strsep(&options, ",")) != NULL) {
+	if (!*this_opt)
+	    continue;
 	if (!strncmp(this_opt, "font:", 5)) {
 	    char *p;
 	    int i;
drivers/video/clgenfb.c +1 -2
diff -ruN linux-2.4.14-pre2/drivers/video/clgenfb.c linux-2.4.14-pre2-rs/drivers/video/clgenfb.c
@@ -2823,8 +2823,7 @@
 	if (!options || !*options)
 		return 0;
 
-	for (this_opt = strtok (options, ","); this_opt != NULL;
-	     this_opt = strtok (NULL, ",")) {
+	while ((this_opt = strsep (&options, ",")) != NULL) {
 		if (!*this_opt) continue;
 
 		DPRINTK("clgenfb_setup: option '%s'\n", this_opt);
drivers/video/controlfb.c +1 -1
diff -ruN linux-2.4.14-pre2/drivers/video/controlfb.c linux-2.4.14-pre2-rs/drivers/video/controlfb.c
@@ -1423,7 +1423,7 @@
 	if (!options || !*options)
 		return;
 
-	while (this_opt = strsep(&options, ",")) {
+	while ((this_opt = strsep(&options, ",")) != NULL) {
 		if (!strncmp(this_opt, "font:", 5)) {
 			char *p;
 			int i;
drivers/video/cyberfb.c +3 -1
diff -ruN linux-2.4.14-pre2/drivers/video/cyberfb.c linux-2.4.14-pre2-rs/drivers/video/cyberfb.c
@@ -1022,7 +1022,9 @@
 		return 0;
 	}
 
-	while (this_opt = strsep(&options, ",")) {
+	while ((this_opt = strsep(&options, ",")) != NULL) {
+		if (!*this_opt)
+			continue;
 		if (!strcmp(this_opt, "inverse")) {
 			Cyberfb_inverse = 1;
 			fb_invert_cmaps();
drivers/video/fm2fb.c +1 -1
diff -ruN linux-2.4.14-pre2/drivers/video/fm2fb.c linux-2.4.14-pre2-rs/drivers/video/fm2fb.c
@@ -430,7 +430,7 @@
     if (!options || !*options)
 	return 0;
 
-    while (this_opt = strsep(&options, ",")) {
+    while ((this_opt = strsep(&options, ",")) != NULL) {
 	if (!strncmp(this_opt, "pal", 3))
 	    fm2fb_mode = FM2FB_MODE_PAL;
 	else if (!strncmp(this_opt, "ntsc", 4))
drivers/video/hgafb.c +1 -1
diff -ruN linux-2.4.14-pre2/drivers/video/hgafb.c linux-2.4.14-pre2-rs/drivers/video/hgafb.c
@@ -795,7 +795,7 @@
 	if (!options || !*options)
 		return 0;
 
-	while (this_opt = strsep(&options, ",")) {
+	while ((this_opt = strsep(&options, ",")) != NULL) {
 		if (!strncmp(this_opt, "font:", 5))
 			strcpy(fb_info.fontname, this_opt+5);
 	}
drivers/video/igafb.c +1 -1
diff -ruN linux-2.4.14-pre2/drivers/video/igafb.c linux-2.4.14-pre2-rs/drivers/video/igafb.c
@@ -773,7 +773,7 @@
     if (!options || !*options)
         return 0;
 
-    while (this_opt = strsep(&options, ",")) {
+    while ((this_opt = strsep(&options, ",")) != NULL) {
         if (!strncmp(this_opt, "font:", 5)) {
                 char *p;
                 int i;
drivers/video/imsttfb.c +1 -1
diff -ruN linux-2.4.14-pre2/drivers/video/imsttfb.c linux-2.4.14-pre2-rs/drivers/video/imsttfb.c
@@ -1977,7 +1977,7 @@
 	if (!options || !*options)
 		return 0;
 
-	while (this_opt = strsep(&options, ",")) {
+	while ((this_opt = strsep(&options, ",")) != NULL) {
 		if (!strncmp(this_opt, "font:", 5)) {
 			char *p;
 			int i;
drivers/video/macfb.c +1 -1
diff -ruN linux-2.4.14-pre2/drivers/video/macfb.c linux-2.4.14-pre2-rs/drivers/video/macfb.c
@@ -848,7 +848,7 @@
 	if (!options || !*options)
 		return;
 	
-	while (this_opt = strsep(&options, ",")) {
+	while ((this_opt = strsep(&options, ",")) != NULL) {
 		if (!*this_opt) continue;
 		
 		if (! strcmp(this_opt, "inverse"))
drivers/video/matrox/matroxfb_base.c +1 -1
diff -ruN linux-2.4.14-pre2/drivers/video/matrox/matroxfb_base.c linux-2.4.14-pre2-rs/drivers/video/matrox/matroxfb_base.c
@@ -2355,7 +2355,7 @@
 	if (!options || !*options)
 		return 0;
 
-	while (this_opt = strsep(&options, ",")) {
+	while ((this_opt = strsep(&options, ",")) != NULL) {
 		if (!*this_opt) continue;
 
 		dprintk("matroxfb_setup: option %s\n", this_opt);
drivers/video/platinumfb.c +1 -1
diff -ruN linux-2.4.14-pre2/drivers/video/platinumfb.c linux-2.4.14-pre2-rs/drivers/video/platinumfb.c
@@ -841,7 +841,7 @@
 	if (!options || !*options)
 		return 0;
 
-	while (this_opt = strsep(&options, ",")) {
+	while ((this_opt = strsep(&options, ",")) != NULL) {
 		if (!strncmp(this_opt, "font:", 5)) {
 			char *p;
 			int i;
drivers/video/radeonfb.c +3 -1
diff -ruN linux-2.4.14-pre2/drivers/video/radeonfb.c linux-2.4.14-pre2-rs/drivers/video/radeonfb.c
@@ -642,7 +642,9 @@
         if (!options || !*options)
                 return 0;
  
-	while (this_opt = strsep (&options, ",")) {
+	while ((this_opt = strsep (&options, ",")) != NULL) {
+		if (!*this_opt)
+			continue;
                 if (!strncmp (this_opt, "font:", 5)) {
                         char *p;
                         int i;
drivers/video/retz3fb.c +3 -1
diff -ruN linux-2.4.14-pre2/drivers/video/retz3fb.c linux-2.4.14-pre2-rs/drivers/video/retz3fb.c
@@ -1348,7 +1348,9 @@
 	if (!options || !*options)
 		return 0;
 
-	while (this_opt = strsep(&options, ",")) {
+	while ((this_opt = strsep(&options, ",")) != NULL) {
+		if (!*this_opt)
+			continue;
 		if (!strcmp(this_opt, "inverse")) {
 			z3fb_inverse = 1;
 			fb_invert_cmaps();
drivers/video/riva/fbdev.c +3 -1
diff -ruN linux-2.4.14-pre2/drivers/video/riva/fbdev.c linux-2.4.14-pre2-rs/drivers/video/riva/fbdev.c
@@ -2045,7 +2045,9 @@
 	if (!options || !*options)
 		return 0;
 
-	while (this_opt = strsep(&options, ",")) {
+	while ((this_opt = strsep(&options, ",")) != NULL) {
+		if (!*this_opt)
+			continue;
 		if (!strncmp(this_opt, "font:", 5)) {
 			char *p;
 			int i;
drivers/video/sa1100fb.c +1 -1
diff -ruN linux-2.4.14-pre2/drivers/video/sa1100fb.c linux-2.4.14-pre2-rs/drivers/video/sa1100fb.c
@@ -2369,7 +2369,7 @@
 	if (!options || !*options)
 		return 0;
 
-	while (this_opt = strsep(&options, ",")) {
+	while ((this_opt = strsep(&options, ",")) != NULL) {
 
 		if (!strncmp(this_opt, "bpp:", 4))
 			current_par.max_bpp =
drivers/video/sgivwfb.c +1 -1
diff -ruN linux-2.4.14-pre2/drivers/video/sgivwfb.c linux-2.4.14-pre2-rs/drivers/video/sgivwfb.c
@@ -862,7 +862,7 @@
   if (!options || !*options)
     return 0;
 
-  while (this_opt = strsep(&options, ",")) {
+  while ((this_opt = strsep(&options, ",")) != NULL) {
     if (!strncmp(this_opt, "font:", 5))
       strcpy(fb_info.fontname, this_opt+5);
   }
drivers/video/sis/sis_main.c +1 -1
diff -ruN linux-2.4.14-pre2/drivers/video/sis/sis_main.c linux-2.4.14-pre2-rs/drivers/video/sis/sis_main.c
@@ -1725,7 +1725,7 @@
 	if (!options || !*options)
 		return 0;
 
-	while (this_opt = strsep(&options, ",")) {
+	while ((this_opt = strsep(&options, ",")) != NULL) {
 		if (!*this_opt)
 			continue;
 
drivers/video/sstfb.c +1 -1
diff -ruN linux-2.4.14-pre2/drivers/video/sstfb.c linux-2.4.14-pre2-rs/drivers/video/sstfb.c
@@ -1697,7 +1697,7 @@
 	if (!options || !*options)
 		return 0;
 
-	while (this_opt = strsep(&options, ",")) {
+	while ((this_opt = strsep(&options, ",")) != NULL) {
 		if (!*this_opt) continue;
 
 		f_ddprintk("option %s\n", this_opt);
drivers/video/tdfxfb.c +3 -1
diff -ruN linux-2.4.14-pre2/drivers/video/tdfxfb.c linux-2.4.14-pre2-rs/drivers/video/tdfxfb.c
@@ -2086,7 +2086,9 @@
   if(!options || !*options)
     return;
 
-  while(this_opt = strsep(&options, ",")) {
+  while((this_opt = strsep(&options, ",")) != NULL) {
+    if(!*this_opt)
+      continue;
     if(!strcmp(this_opt, "inverse")) {
       inverse = 1;
       fb_invert_cmaps();
drivers/video/tgafb.c +1 -1
diff -ruN linux-2.4.14-pre2/drivers/video/tgafb.c linux-2.4.14-pre2-rs/drivers/video/tgafb.c
@@ -889,7 +889,7 @@
     int i;
     
     if (options && *options) {
-    	while (this_opt = strsep(&options, ",")) {
+    	while ((this_opt = strsep(&options, ",")) != NULL) {
        	    if (!*this_opt) { continue; }
         
 	    if (!strncmp(this_opt, "font:", 5)) {
drivers/video/valkyriefb.c +1 -1
diff -ruN linux-2.4.14-pre2/drivers/video/valkyriefb.c linux-2.4.14-pre2-rs/drivers/video/valkyriefb.c
@@ -801,7 +801,7 @@
 	if (!options || !*options)
 		return 0;
 
-	while (this_opt = strsep(&options, ",")) {
+	while ((this_opt = strsep(&options, ",")) != NULL) {
 		if (!strncmp(this_opt, "font:", 5)) {
 			char *p;
 			int i;
drivers/video/vesafb.c +1 -1
diff -ruN linux-2.4.14-pre2/drivers/video/vesafb.c linux-2.4.14-pre2-rs/drivers/video/vesafb.c
@@ -457,7 +457,7 @@
 	if (!options || !*options)
 		return 0;
 	
-	while (this_opt = strsep(&options, ",")) {
+	while ((this_opt = strsep(&options, ",")) != NULL) {
 		if (!*this_opt) continue;
 		
 		if (! strcmp(this_opt, "inverse"))
drivers/video/vfb.c +1 -1
diff -ruN linux-2.4.14-pre2/drivers/video/vfb.c linux-2.4.14-pre2-rs/drivers/video/vfb.c
@@ -382,7 +382,7 @@
     if (!options || !*options)
 	return 0;
 
-    while (this_opt = strsep(&options, ",")) {
+    while ((this_opt = strsep(&options, ",")) != NULL) {
 	if (!strncmp(this_opt, "font:", 5))
 	    strcpy(fb_info.fontname, this_opt+5);
     }
drivers/video/vga16fb.c +1 -1
diff -ruN linux-2.4.14-pre2/drivers/video/vga16fb.c linux-2.4.14-pre2-rs/drivers/video/vga16fb.c
@@ -692,7 +692,7 @@
 	if (!options || !*options)
 		return 0;
 	
-	while (this_opt = strsep(&options, ",")) {
+	while ((this_opt = strsep(&options, ",")) != NULL) {
 		if (!*this_opt) continue;
 		
 		if (!strncmp(this_opt, "font:", 5))
fs/adfs/super.c +3 -1
diff -ruN linux-2.4.14-pre2/fs/adfs/super.c linux-2.4.14-pre2-rs/fs/adfs/super.c
@@ -171,7 +171,9 @@
 	if (!options)
 		return 0;
 
-	for (opt = strtok(options, ","); opt != NULL; opt = strtok(NULL, ",")) {
+	while ((opt = strsep(&options, ",")) != NULL) {
+		if (!*opt)
+			continue;
 		value = strchr(opt, '=');
 		if (value)
 			*value++ = '\0';
fs/affs/super.c +3 -1
diff -ruN linux-2.4.14-pre2/fs/affs/super.c linux-2.4.14-pre2-rs/fs/affs/super.c
@@ -109,7 +109,9 @@
 	*mount_opts = 0;
 	if (!options)
 		return 1;
-	for (this_char = strtok(options,","); this_char; this_char = strtok(NULL,",")) {
+	while ((this_char = strsep(&options, ",")) != NULL) {
+		if (!*this_char)
+			continue;
 		f = 0;
 		if ((value = strchr(this_char,'=')) != NULL)
 			*value++ = 0;
fs/autofs/inode.c +3 -1
diff -ruN linux-2.4.14-pre2/fs/autofs/inode.c linux-2.4.14-pre2-rs/fs/autofs/inode.c
@@ -60,7 +60,9 @@
 	*pipefd = -1;
 
 	if ( !options ) return 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)
 			*value++ = 0;
 		if (!strcmp(this_char,"fd")) {
fs/autofs4/inode.c +3 -1
diff -ruN linux-2.4.14-pre2/fs/autofs4/inode.c linux-2.4.14-pre2-rs/fs/autofs4/inode.c
@@ -112,7 +112,9 @@
 	*pipefd = -1;
 
 	if ( !options ) return 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)
 			*value++ = 0;
 		if (!strcmp(this_char,"fd")) {
fs/devpts/inode.c +6 -4
diff -ruN linux-2.4.14-pre2/fs/devpts/inode.c linux-2.4.14-pre2-rs/fs/devpts/inode.c
@@ -66,10 +66,11 @@
 	umode_t mode = 0600;
 	char *this_char, *value;
 
-	this_char = NULL;
-	if ( options )
-		this_char = strtok(options,",");
-	for ( ; this_char; this_char = strtok(NULL,",")) {
+	if (!options)
+		goto default_settings;
+	while (( this_char = strsep(&options,",") ) != NULL) {
+		if (!*this_char)
+			continue;
 		if ((value = strchr(this_char,'=')) != NULL)
 			*value++ = 0;
 		if (!strcmp(this_char,"uid")) {
@@ -98,6 +99,7 @@
 		else
 			return 1;
 	}
+default_settings:
 	sbi->setuid  = setuid;
 	sbi->setgid  = setgid;
 	sbi->uid     = uid;
fs/ext2/super.c +3 -3
diff -ruN linux-2.4.14-pre2/fs/ext2/super.c linux-2.4.14-pre2-rs/fs/ext2/super.c
@@ -166,9 +166,9 @@
 
 	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"))
fs/fat/inode.c +2 -3
diff -ruN linux-2.4.14-pre2/fs/fat/inode.c linux-2.4.14-pre2-rs/fs/fat/inode.c
@@ -210,7 +210,7 @@
 			 char *cvf_format, char *cvf_options)
 {
 	char *this_char,*value,save,*savep;
-	char *p;
+	char *p,*options_p = options;
 	int ret = 1, len;
 
 	opts->name_check = 'n';
@@ -230,8 +230,7 @@
 		goto out;
 	save = 0;
 	savep = NULL;
-	for (this_char = strtok(options,","); this_char;
-	     this_char = strtok(NULL,",")) {
+	while ((this_char = strsep(&options_p, ",")) != NULL) {
 		if ((value = strchr(this_char,'=')) != NULL) {
 			save = *value;
 			savep = value;
fs/hfs/super.c +3 -2
diff -ruN linux-2.4.14-pre2/fs/hfs/super.c linux-2.4.14-pre2-rs/fs/hfs/super.c
@@ -181,8 +181,9 @@
 	if (!options) {
 		goto done;
 	}
-	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) {
 			*value++ = 0;
 		}
fs/hpfs/super.c +3 -1
diff -ruN linux-2.4.14-pre2/fs/hpfs/super.c linux-2.4.14-pre2-rs/fs/hpfs/super.c
@@ -176,7 +176,9 @@
 
 	/*printk("Parsing opts: '%s'\n",opts);*/
 
-	for (p = strtok(opts, ","); p != 0; p = strtok(0, ",")) {
+	while ((p = strsep(&opts, ",")) != NULL) {
+		if (!*p)
+			continue;
 		if ((rhs = strchr(p, '=')) != 0)
 			*rhs++ = '\0';
 		if (!strcmp(p, "help")) return 2;
fs/isofs/inode.c +3 -1
diff -ruN linux-2.4.14-pre2/fs/isofs/inode.c linux-2.4.14-pre2-rs/fs/isofs/inode.c
@@ -294,7 +294,9 @@
 	popt->session=-1;
 	popt->sbsector=-1;
 	if (!options) return 1;
-	for (this_char = strtok(options,","); this_char; this_char = strtok(NULL,",")) {
+	while ((this_char = strsep(&options,",")) != NULL) {
+		if (!*this_char)
+			continue;
 	        if (strncmp(this_char,"norock",6) == 0) {
 		  popt->rock = 'n';
 		  continue;
fs/nfs/nfsroot.c +3 -3
diff -ruN linux-2.4.14-pre2/fs/nfs/nfsroot.c linux-2.4.14-pre2-rs/fs/nfs/nfsroot.c
@@ -202,8 +202,9 @@
 
 	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 @@
 					nfs_data.flags |= opts->or_mask;
 				}
 			}
-			cp = strtok(NULL, ",");
 		}
 	}
 	if (name[0] && strcmp(name, "default")) {
fs/ntfs/fs.c +4 -1
diff -ruN linux-2.4.14-pre2/fs/ntfs/fs.c linux-2.4.14-pre2-rs/fs/ntfs/fs.c
@@ -365,10 +365,13 @@
 	int use_utf8 = -1;	/* If no NLS specified and loading the default
 				   NLS failed use utf8. */
 	int mft_zone_mul = -1;	/* 1 */
+	char *options = opt;
 
 	if (!opt)
 		goto done;
-	for (opt = strtok(opt, ","); opt; opt = strtok(NULL, ",")) {
+	while ((opt = strsep(&options, ",")) != NULL) {
+		if (!*opt)
+			continue;
 		if ((value = strchr(opt, '=')) != NULL)
 			*value ++= '\0';
 		if (strcmp(opt, "uid") == 0) {
fs/proc/inode.c +3 -1
diff -ruN linux-2.4.14-pre2/fs/proc/inode.c linux-2.4.14-pre2-rs/fs/proc/inode.c
@@ -106,7 +106,9 @@
 	*uid = current->uid;
 	*gid = current->gid;
 	if (!options) return 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)
 			*value++ = 0;
 		if (!strcmp(this_char,"uid")) {
fs/reiserfs/super.c +3 -1
diff -ruN linux-2.4.14-pre2/fs/reiserfs/super.c linux-2.4.14-pre2-rs/fs/reiserfs/super.c
@@ -144,7 +144,9 @@
 	/* use default configuration: create tails, journaling on, no
            conversion to newest format */
 	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, "notail")) {
fs/udf/super.c +3 -1
diff -ruN linux-2.4.14-pre2/fs/udf/super.c linux-2.4.14-pre2-rs/fs/udf/super.c
@@ -218,8 +218,10 @@
 	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)
fs/ufs/super.c +3 -4
diff -ruN linux-2.4.14-pre2/fs/ufs/super.c linux-2.4.14-pre2-rs/fs/ufs/super.c
@@ -257,10 +257,9 @@
 	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")) {
fs/vfat/namei.c +2 -1
diff -ruN linux-2.4.14-pre2/fs/vfat/namei.c linux-2.4.14-pre2-rs/fs/vfat/namei.c
@@ -104,6 +104,7 @@
 {
 	char *this_char,*value,save,*savep;
 	int ret, val;
+	char *options_p = options;
 
 	opts->unicode_xlate = opts->posixfs = 0;
 	opts->numtail = 1;
@@ -120,7 +121,7 @@
 	save = 0;
 	savep = NULL;
 	ret = 1;
-	for (this_char = strtok(options,","); this_char; this_char = strtok(NULL,",")) {
+	while ((this_char = strsep(&options_p, ",")) != NULL) {
 		if ((value = strchr(this_char,'=')) != NULL) {
 			save = *value;
 			savep = value;
mm/shmem.c +5 -4
diff -ruN linux-2.4.14-pre2/mm/shmem.c linux-2.4.14-pre2-rs/mm/shmem.c
@@ -1230,10 +1230,11 @@
 {
 	char *this_char, *value, *rest;
 
-	this_char = NULL;
-	if ( options )
-		this_char = strtok(options,",");
-	for ( ; this_char; this_char = strtok(NULL,",")) {
+	if (!options)
+		return 0;
+	while ((this_char = strsep(&options,",")) != NULL) {
+		if (!*this_char)
+			continue;
 		if ((value = strchr(this_char,'=')) != NULL) {
 			*value++ = 0;
 		} else {
#4 lore raw
In reply to Linus Torvalds

Hi,

I suspect my last patch on that subject was too fat to get very far. Here it comes again, this time nicely sliced.

This part just adds a missing '}' to virgefb.c which I failed to provide in the first patch.

René

drivers/video/virgefb.c +1 -0
diff -ruN linux-2.4.14-pre2/drivers/video/virgefb.c linux-2.4.14-pre2-rs/drivers/video/virgefb.c
@@ -1099,6 +1101,7 @@
 		}
 		else
 			get_video_mode(this_opt);
+	}
 
 	DPRINTK("default mode: xres=%d, yres=%d, bpp=%d\n",virgefb_default.xres,
                                                            virgefb_default.yres,