2001-10-21 14:07:06

by Ren

[permalink] [raw]
Subject: [PATCH] strtok --> strsep in framebuffer drivers

Hi,

here is a patch to eliminate all uses of strtok from the framebuffer
drivers. This is another step towards a strtok-free kernel. ;-)

It applies cleanly against kernels 2.4.13-pre5 and, with a few offsets,
2.4.12-ac3.

This patch is a bit lengthy, but hopefully easy to verify. Err, and I
did NOT test this thing. Maybe it doesn't even compile. That said,
please take a look at it and consider applying. It's not as I could've
made many mistakes after all (hi Rusty! :).

Ren?



diff -ur linux-2.4.13-pre5/drivers/video/acornfb.c
linux-2.4.13-pre5-rs/drivers/video/acornfb.c
--- linux-2.4.13-pre5/drivers/video/acornfb.c Sun Oct 21 13:06:21 2001
+++ linux-2.4.13-pre5-rs/drivers/video/acornfb.c Sun Oct 21 12:33:25 2001
@@ -1528,7 +1528,7 @@

acornfb_init_fbinfo();

- for (opt = strtok(options, ","); opt; opt = strtok(NULL, ",")) {
+ while (opt = strsep(&options, ",")) {
if (!*opt)
continue;

diff -ur linux-2.4.13-pre5/drivers/video/amifb.c
linux-2.4.13-pre5-rs/drivers/video/amifb.c
--- linux-2.4.13-pre5/drivers/video/amifb.c Fri Sep 14 01:04:43 2001
+++ linux-2.4.13-pre5-rs/drivers/video/amifb.c Sun Oct 21 12:34:28 2001
@@ -1192,7 +1192,7 @@
if (!options || !*options)
return 0;

- for (this_opt = strtok(options, ","); this_opt; this_opt = strtok(NULL,
",")) {
+ while (this_opt = strsep(&options, ",")) {
if (!strcmp(this_opt, "inverse")) {
amifb_inverse = 1;
fb_invert_cmaps();
diff -ur linux-2.4.13-pre5/drivers/video/aty/atyfb_base.c
linux-2.4.13-pre5-rs/drivers/video/aty/atyfb_base.c
--- linux-2.4.13-pre5/drivers/video/aty/atyfb_base.c Fri Sep 14 01:04:43 2001
+++ linux-2.4.13-pre5-rs/drivers/video/aty/atyfb_base.c Sun Oct 21 12:34:56
2001
@@ -2521,8 +2521,7 @@
if (!options || !*options)
return 0;

- for (this_opt = strtok(options, ","); this_opt;
- this_opt = strtok(NULL, ",")) {
+ while (this_opt = strsep(&options, ",")) {
if (!strncmp(this_opt, "font:", 5)) {
char *p;
int i;
diff -ur linux-2.4.13-pre5/drivers/video/aty128fb.c
linux-2.4.13-pre5-rs/drivers/video/aty128fb.c
--- linux-2.4.13-pre5/drivers/video/aty128fb.c Mon Jul 2 23:13:40 2001
+++ linux-2.4.13-pre5-rs/drivers/video/aty128fb.c Sun Oct 21 12:35:26 2001
@@ -1613,8 +1613,7 @@
if (!options || !*options)
return 0;

- for (this_opt = strtok(options, ","); this_opt;
- this_opt = strtok(NULL, ",")) {
+ while (this_opt = strsep(&options, ",")) {
if (!strncmp(this_opt, "font:", 5)) {
char *p;
int i;
diff -ur linux-2.4.13-pre5/drivers/video/controlfb.c
linux-2.4.13-pre5-rs/drivers/video/controlfb.c
--- linux-2.4.13-pre5/drivers/video/controlfb.c Tue Oct 2 18:10:31 2001
+++ linux-2.4.13-pre5-rs/drivers/video/controlfb.c Sun Oct 21 12:37:34 2001
@@ -1423,8 +1423,7 @@
if (!options || !*options)
return;

- for (this_opt = strtok(options, ","); this_opt;
- this_opt = strtok(NULL, ",")) {
+ while (this_opt = strsep(&options, ",")) {
if (!strncmp(this_opt, "font:", 5)) {
char *p;
int i;
diff -ur linux-2.4.13-pre5/drivers/video/cyberfb.c
linux-2.4.13-pre5-rs/drivers/video/cyberfb.c
--- linux-2.4.13-pre5/drivers/video/cyberfb.c Fri Sep 14 01:04:43 2001
+++ linux-2.4.13-pre5-rs/drivers/video/cyberfb.c Sun Oct 21 12:38:01 2001
@@ -1022,8 +1022,7 @@
return 0;
}

- for (this_opt = strtok(options, ","); this_opt;
- this_opt = strtok(NULL, ",")) {
+ while (this_opt = strsep(&options, ",")) {
if (!strcmp(this_opt, "inverse")) {
Cyberfb_inverse = 1;
fb_invert_cmaps();
diff -ur linux-2.4.13-pre5/drivers/video/fm2fb.c
linux-2.4.13-pre5-rs/drivers/video/fm2fb.c
--- linux-2.4.13-pre5/drivers/video/fm2fb.c Fri Sep 14 01:04:43 2001
+++ linux-2.4.13-pre5-rs/drivers/video/fm2fb.c Sun Oct 21 12:42:02 2001
@@ -430,8 +430,7 @@
if (!options || !*options)
return 0;

- for (this_opt = strtok(options, ","); this_opt;
- this_opt = strtok(NULL, ",")) {
+ while (this_opt = strsep(&options, ",")) {
if (!strncmp(this_opt, "pal", 3))
fm2fb_mode = FM2FB_MODE_PAL;
else if (!strncmp(this_opt, "ntsc", 4))
diff -ur linux-2.4.13-pre5/drivers/video/hgafb.c
linux-2.4.13-pre5-rs/drivers/video/hgafb.c
--- linux-2.4.13-pre5/drivers/video/hgafb.c Sun Oct 21 13:06:21 2001
+++ linux-2.4.13-pre5-rs/drivers/video/hgafb.c Sun Oct 21 12:42:57 2001
@@ -795,8 +795,7 @@
if (!options || !*options)
return 0;

- for (this_opt = strtok(options, ","); this_opt;
- this_opt = strtok(NULL, ",")) {
+ while (this_opt = strsep(&options, ",")) {
if (!strncmp(this_opt, "font:", 5))
strcpy(fb_info.fontname, this_opt+5);
}
diff -ur linux-2.4.13-pre5/drivers/video/igafb.c
linux-2.4.13-pre5-rs/drivers/video/igafb.c
--- linux-2.4.13-pre5/drivers/video/igafb.c Fri Sep 14 01:04:43 2001
+++ linux-2.4.13-pre5-rs/drivers/video/igafb.c Sun Oct 21 12:44:04 2001
@@ -773,8 +773,7 @@
if (!options || !*options)
return 0;

- for (this_opt = strtok(options, ","); this_opt;
- this_opt = strtok(NULL, ",")) {
+ while (this_opt = strsep(&options, ",")) {
if (!strncmp(this_opt, "font:", 5)) {
char *p;
int i;
diff -ur linux-2.4.13-pre5/drivers/video/imsttfb.c
linux-2.4.13-pre5-rs/drivers/video/imsttfb.c
--- linux-2.4.13-pre5/drivers/video/imsttfb.c Fri Sep 14 01:04:43 2001
+++ linux-2.4.13-pre5-rs/drivers/video/imsttfb.c Sun Oct 21 12:44:36 2001
@@ -1977,8 +1977,7 @@
if (!options || !*options)
return 0;

- for (this_opt = strtok(options, ","); this_opt;
- this_opt = strtok(NULL, ",")) {
+ while (this_opt = strsep(&options, ",")) {
if (!strncmp(this_opt, "font:", 5)) {
char *p;
int i;
diff -ur linux-2.4.13-pre5/drivers/video/macfb.c
linux-2.4.13-pre5-rs/drivers/video/macfb.c
--- linux-2.4.13-pre5/drivers/video/macfb.c Fri Sep 14 01:04:43 2001
+++ linux-2.4.13-pre5-rs/drivers/video/macfb.c Sun Oct 21 12:45:23 2001
@@ -848,7 +848,7 @@
if (!options || !*options)
return;

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

if (! strcmp(this_opt, "inverse"))
diff -ur linux-2.4.13-pre5/drivers/video/matrox/matroxfb_base.c
linux-2.4.13-pre5-rs/drivers/video/matrox/matroxfb_base.c
--- linux-2.4.13-pre5/drivers/video/matrox/matroxfb_base.c Sun Sep 30
21:26:08 2001
+++ linux-2.4.13-pre5-rs/drivers/video/matrox/matroxfb_base.c Sun Oct 21
12:46:21 2001
@@ -2355,7 +2355,7 @@
if (!options || !*options)
return 0;

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

dprintk("matroxfb_setup: option %s\n", this_opt);
diff -ur linux-2.4.13-pre5/drivers/video/platinumfb.c
linux-2.4.13-pre5-rs/drivers/video/platinumfb.c
--- linux-2.4.13-pre5/drivers/video/platinumfb.c Fri Sep 14 01:04:43 2001
+++ linux-2.4.13-pre5-rs/drivers/video/platinumfb.c Sun Oct 21 12:52:45 2001
@@ -841,8 +841,7 @@
if (!options || !*options)
return 0;

- for (this_opt = strtok(options, ","); this_opt;
- this_opt = strtok(NULL, ",")) {
+ while (this_opt = strsep(&options, ",")) {
if (!strncmp(this_opt, "font:", 5)) {
char *p;
int i;
diff -ur linux-2.4.13-pre5/drivers/video/radeonfb.c
linux-2.4.13-pre5-rs/drivers/video/radeonfb.c
--- linux-2.4.13-pre5/drivers/video/radeonfb.c Sun Sep 9 19:52:35 2001
+++ linux-2.4.13-pre5-rs/drivers/video/radeonfb.c Sun Oct 21 12:53:17 2001
@@ -537,8 +537,7 @@
if (!options || !*options)
return 0;

- for (this_opt = strtok (options, ","); this_opt;
- this_opt = strtok (NULL, ",")) {
+ while (this_opt = strsep (&options, ",")) {
if (!strncmp (this_opt, "font:", 5)) {
char *p;
int i;
diff -ur linux-2.4.13-pre5/drivers/video/retz3fb.c
linux-2.4.13-pre5-rs/drivers/video/retz3fb.c
--- linux-2.4.13-pre5/drivers/video/retz3fb.c Fri Sep 14 01:04:43 2001
+++ linux-2.4.13-pre5-rs/drivers/video/retz3fb.c Sun Oct 21 12:53:49 2001
@@ -1348,8 +1348,7 @@
if (!options || !*options)
return 0;

- for (this_opt = strtok(options, ","); this_opt;
- this_opt = strtok(NULL, ",")){
+ while (this_opt = strsep(&options, ",")) {
if (!strcmp(this_opt, "inverse")) {
z3fb_inverse = 1;
fb_invert_cmaps();
diff -ur linux-2.4.13-pre5/drivers/video/riva/fbdev.c
linux-2.4.13-pre5-rs/drivers/video/riva/fbdev.c
--- linux-2.4.13-pre5/drivers/video/riva/fbdev.c Sun Sep 30 21:26:08 2001
+++ linux-2.4.13-pre5-rs/drivers/video/riva/fbdev.c Sun Oct 21 12:54:12 2001
@@ -2045,8 +2045,7 @@
if (!options || !*options)
return 0;

- for (this_opt = strtok(options, ","); this_opt;
- this_opt = strtok(NULL, ",")) {
+ while (this_opt = strsep(&options, ",")) {
if (!strncmp(this_opt, "font:", 5)) {
char *p;
int i;
diff -ur linux-2.4.13-pre5/drivers/video/sa1100fb.c
linux-2.4.13-pre5-rs/drivers/video/sa1100fb.c
--- linux-2.4.13-pre5/drivers/video/sa1100fb.c Fri Sep 14 01:04:43 2001
+++ linux-2.4.13-pre5-rs/drivers/video/sa1100fb.c Sun Oct 21 12:54:46 2001
@@ -2299,8 +2299,7 @@
if (!options || !*options)
return 0;

- for (this_opt = strtok(options, ","); this_opt;
- this_opt = strtok(NULL, ",")) {
+ while (this_opt = strsep(&options, ",")) {

if (!strncmp(this_opt, "bpp:", 4))
current_par.max_bpp =
diff -ur linux-2.4.13-pre5/drivers/video/sgivwfb.c
linux-2.4.13-pre5-rs/drivers/video/sgivwfb.c
--- linux-2.4.13-pre5/drivers/video/sgivwfb.c Fri Feb 9 20:30:23 2001
+++ linux-2.4.13-pre5-rs/drivers/video/sgivwfb.c Sun Oct 21 12:57:06 2001
@@ -862,8 +862,7 @@
if (!options || !*options)
return 0;

- for (this_opt = strtok(options, ","); this_opt;
- this_opt = strtok(NULL, ",")) {
+ while (this_opt = strsep(&options, ",")) {
if (!strncmp(this_opt, "font:", 5))
strcpy(fb_info.fontname, this_opt+5);
}
diff -ur linux-2.4.13-pre5/drivers/video/sis/sis_main.c
linux-2.4.13-pre5-rs/drivers/video/sis/sis_main.c
--- linux-2.4.13-pre5/drivers/video/sis/sis_main.c Fri Sep 14 23:40:00 2001
+++ linux-2.4.13-pre5-rs/drivers/video/sis/sis_main.c Sun Oct 21 12:57:29 2001
@@ -1726,8 +1726,7 @@
if (!options || !*options)
return 0;

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

diff -ur linux-2.4.13-pre5/drivers/video/sstfb.c
linux-2.4.13-pre5-rs/drivers/video/sstfb.c
--- linux-2.4.13-pre5/drivers/video/sstfb.c Fri Sep 7 18:28:38 2001
+++ linux-2.4.13-pre5-rs/drivers/video/sstfb.c Sun Oct 21 12:57:57 2001
@@ -1697,8 +1697,7 @@
if (!options || !*options)
return 0;

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

f_ddprintk("option %s\n", this_opt);
diff -ur linux-2.4.13-pre5/drivers/video/tdfxfb.c
linux-2.4.13-pre5-rs/drivers/video/tdfxfb.c
--- linux-2.4.13-pre5/drivers/video/tdfxfb.c Sun Oct 21 13:06:22 2001
+++ linux-2.4.13-pre5-rs/drivers/video/tdfxfb.c Sun Oct 21 12:58:28 2001
@@ -2086,9 +2086,7 @@
if(!options || !*options)
return;

- for(this_opt = strtok(options, ",");
- this_opt;
- this_opt = strtok(NULL, ",")) {
+ while(this_opt = strsep(&options, ",")) {
if(!strcmp(this_opt, "inverse")) {
inverse = 1;
fb_invert_cmaps();
diff -ur linux-2.4.13-pre5/drivers/video/tgafb.c
linux-2.4.13-pre5-rs/drivers/video/tgafb.c
--- linux-2.4.13-pre5/drivers/video/tgafb.c Fri Sep 14 01:04:43 2001
+++ linux-2.4.13-pre5-rs/drivers/video/tgafb.c Sun Oct 21 13:00:04 2001
@@ -889,7 +889,7 @@
int i;

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

if (!strncmp(this_opt, "font:", 5)) {
diff -ur linux-2.4.13-pre5/drivers/video/valkyriefb.c
linux-2.4.13-pre5-rs/drivers/video/valkyriefb.c
--- linux-2.4.13-pre5/drivers/video/valkyriefb.c Fri Sep 14 01:04:43 2001
+++ linux-2.4.13-pre5-rs/drivers/video/valkyriefb.c Sun Oct 21 13:00:27 2001
@@ -801,8 +801,7 @@
if (!options || !*options)
return 0;

- for (this_opt = strtok(options, ","); this_opt;
- this_opt = strtok(NULL, ",")) {
+ while (this_opt = strsep(&options, ",")) {
if (!strncmp(this_opt, "font:", 5)) {
char *p;
int i;
diff -ur linux-2.4.13-pre5/drivers/video/vesafb.c
linux-2.4.13-pre5-rs/drivers/video/vesafb.c
--- linux-2.4.13-pre5/drivers/video/vesafb.c Wed Apr 18 20:49:12 2001
+++ linux-2.4.13-pre5-rs/drivers/video/vesafb.c Sun Oct 21 13:00:46 2001
@@ -457,7 +457,7 @@
if (!options || !*options)
return 0;

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

if (! strcmp(this_opt, "inverse"))
diff -ur linux-2.4.13-pre5/drivers/video/vfb.c
linux-2.4.13-pre5-rs/drivers/video/vfb.c
--- linux-2.4.13-pre5/drivers/video/vfb.c Fri Sep 14 01:04:43 2001
+++ linux-2.4.13-pre5-rs/drivers/video/vfb.c Sun Oct 21 13:01:03 2001
@@ -382,8 +382,7 @@
if (!options || !*options)
return 0;

- for (this_opt = strtok(options, ","); this_opt;
- this_opt = strtok(NULL, ",")) {
+ while (this_opt = strsep(&options, ",")) {
if (!strncmp(this_opt, "font:", 5))
strcpy(fb_info.fontname, this_opt+5);
}
diff -ur linux-2.4.13-pre5/drivers/video/vga16fb.c
linux-2.4.13-pre5-rs/drivers/video/vga16fb.c
--- linux-2.4.13-pre5/drivers/video/vga16fb.c Fri Sep 14 01:04:43 2001
+++ linux-2.4.13-pre5-rs/drivers/video/vga16fb.c Sun Oct 21 13:01:51 2001
@@ -692,7 +692,7 @@
if (!options || !*options)
return 0;

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

if (!strncmp(this_opt, "font:", 5))
diff -ur linux-2.4.13-pre5/drivers/video/virgefb.c
linux-2.4.13-pre5-rs/drivers/video/virgefb.c
--- linux-2.4.13-pre5/drivers/video/virgefb.c Fri Sep 14 01:04:43 2001
+++ linux-2.4.13-pre5-rs/drivers/video/virgefb.c Sun Oct 21 13:02:11 2001
@@ -1085,7 +1085,7 @@
if (!options || !*options)
return 0;

- for (this_opt = strtok(options, ","); this_opt; this_opt = strtok(NULL,
","))
+ while (this_opt = strsep(&options, ",")) {
if (!strcmp(this_opt, "inverse")) {
Cyberfb_inverse = 1;
fb_invert_cmaps();


2001-10-25 21:54:19

by Ren

[permalink] [raw]
Subject: Re: [PATCH] strtok --> strsep in framebuffer drivers

Am Donnerstag, 25. Oktober 2001 08:58 schrieben Sie:
> In article <[email protected]> you write:
> >- 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
--- linux-2.4.13-rs/drivers/video/acornfb.c Wed Oct 24 19:19:03 2001
+++ linux-2.4.13-rs2/drivers/video/acornfb.c Thu Oct 25 22:39:26 2001
@@ -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
--- linux-2.4.13-rs/drivers/video/amifb.c Thu Oct 25 00:44:56 2001
+++ linux-2.4.13-rs2/drivers/video/amifb.c Thu Oct 25 22:41:47 2001
@@ -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
--- linux-2.4.13-rs/drivers/video/atafb.c Thu Oct 25 00:44:56 2001
+++ linux-2.4.13-rs2/drivers/video/atafb.c Thu Oct 25 22:42:05 2001
@@ -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
--- linux-2.4.13-rs/drivers/video/aty/atyfb_base.c Thu Oct 25 00:44:56 2001
+++ linux-2.4.13-rs2/drivers/video/aty/atyfb_base.c Thu Oct 25 22:37:56 2001
@@ -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
--- linux-2.4.13-rs/drivers/video/aty128fb.c Thu Oct 25 00:44:56 2001
+++ linux-2.4.13-rs2/drivers/video/aty128fb.c Thu Oct 25 22:38:29 2001
@@ -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
--- linux-2.4.13-rs/drivers/video/clgenfb.c Thu Oct 25 00:44:56 2001
+++ linux-2.4.13-rs2/drivers/video/clgenfb.c Thu Oct 25 22:40:36 2001
@@ -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
--- linux-2.4.13-rs/drivers/video/controlfb.c Wed Oct 24 19:19:04 2001
+++ linux-2.4.13-rs2/drivers/video/controlfb.c Thu Oct 25 22:41:03 2001
@@ -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
--- linux-2.4.13-rs/drivers/video/cyberfb.c Thu Oct 25 00:44:56 2001
+++ linux-2.4.13-rs2/drivers/video/cyberfb.c Thu Oct 25 22:41:12 2001
@@ -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
--- linux-2.4.13-rs/drivers/video/fm2fb.c Wed Oct 24 19:19:04 2001
+++ linux-2.4.13-rs2/drivers/video/fm2fb.c Thu Oct 25 22:40:19 2001
@@ -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
--- linux-2.4.13-rs/drivers/video/hgafb.c Wed Oct 24 19:19:04 2001
+++ linux-2.4.13-rs2/drivers/video/hgafb.c Thu Oct 25 22:41:31 2001
@@ -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
--- linux-2.4.13-rs/drivers/video/igafb.c Wed Oct 24 19:19:04 2001
+++ linux-2.4.13-rs2/drivers/video/igafb.c Thu Oct 25 22:41:57 2001
@@ -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
--- linux-2.4.13-rs/drivers/video/imsttfb.c Wed Oct 24 19:19:04 2001
+++ linux-2.4.13-rs2/drivers/video/imsttfb.c Thu Oct 25 22:40:09 2001
@@ -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
--- linux-2.4.13-rs/drivers/video/macfb.c Wed Oct 24 19:19:04 2001
+++ linux-2.4.13-rs2/drivers/video/macfb.c Thu Oct 25 22:39:51 2001
@@ -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
--- linux-2.4.13-rs/drivers/video/platinumfb.c Wed Oct 24 19:19:04 2001
+++ linux-2.4.13-rs2/drivers/video/platinumfb.c Thu Oct 25 22:42:14 2001
@@ -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
--- linux-2.4.13-rs/drivers/video/radeonfb.c Thu Oct 25 00:44:56 2001
+++ linux-2.4.13-rs2/drivers/video/radeonfb.c Thu Oct 25 22:39:34 2001
@@ -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
--- linux-2.4.13-rs/drivers/video/retz3fb.c Thu Oct 25 00:44:56 2001
+++ linux-2.4.13-rs2/drivers/video/retz3fb.c Thu Oct 25 22:42:23 2001
@@ -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
--- linux-2.4.13-rs/drivers/video/riva/fbdev.c Thu Oct 25 00:44:56 2001
+++ linux-2.4.13-rs2/drivers/video/riva/fbdev.c Thu Oct 25 22:38:13 2001
@@ -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
--- linux-2.4.13-rs/drivers/video/sa1100fb.c Wed Oct 24 19:19:04 2001
+++ linux-2.4.13-rs2/drivers/video/sa1100fb.c Thu Oct 25 22:39:42 2001
@@ -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
--- linux-2.4.13-rs/drivers/video/sgivwfb.c Wed Oct 24 19:19:04 2001
+++ linux-2.4.13-rs2/drivers/video/sgivwfb.c Thu Oct 25 22:38:54 2001
@@ -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
--- linux-2.4.13-rs/drivers/video/sis/sis_main.c Wed Oct 24 19:19:04 2001
+++ linux-2.4.13-rs2/drivers/video/sis/sis_main.c Thu Oct 25 22:38:04 2001
@@ -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
--- linux-2.4.13-rs/drivers/video/sstfb.c Wed Oct 24 19:19:04 2001
+++ linux-2.4.13-rs2/drivers/video/sstfb.c Thu Oct 25 22:40:45 2001
@@ -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
--- linux-2.4.13-rs/drivers/video/tdfxfb.c Thu Oct 25 00:44:56 2001
+++ linux-2.4.13-rs2/drivers/video/tdfxfb.c Thu Oct 25 22:38:38 2001
@@ -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
--- linux-2.4.13-rs/drivers/video/tgafb.c Wed Oct 24 19:19:04 2001
+++ linux-2.4.13-rs2/drivers/video/tgafb.c Thu Oct 25 22:40:28 2001
@@ -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
--- linux-2.4.13-rs/drivers/video/valkyriefb.c Wed Oct 24 19:19:04 2001
+++ linux-2.4.13-rs2/drivers/video/valkyriefb.c Thu Oct 25 22:38:21 2001
@@ -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
--- linux-2.4.13-rs/drivers/video/vesafb.c Wed Oct 24 19:19:04 2001
+++ linux-2.4.13-rs2/drivers/video/vesafb.c Thu Oct 25 22:40:55 2001
@@ -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
--- linux-2.4.13-rs/drivers/video/vfb.c Wed Oct 24 19:19:04 2001
+++ linux-2.4.13-rs2/drivers/video/vfb.c Thu Oct 25 22:39:04 2001
@@ -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
--- linux-2.4.13-rs/drivers/video/vga16fb.c Wed Oct 24 19:19:04 2001
+++ linux-2.4.13-rs2/drivers/video/vga16fb.c Thu Oct 25 22:41:39 2001
@@ -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
--- linux-2.4.13-rs/drivers/video/virgefb.c Thu Oct 25 00:44:56 2001
+++ linux-2.4.13-rs2/drivers/video/virgefb.c Thu Oct 25 22:38:46 2001
@@ -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")) {
diff -ruN linux-2.4.13-rs/fs/adfs/super.c linux-2.4.13-rs2/fs/adfs/super.c
--- linux-2.4.13-rs/fs/adfs/super.c Thu Oct 25 22:20:28 2001
+++ linux-2.4.13-rs2/fs/adfs/super.c Thu Oct 25 22:34:16 2001
@@ -171,7 +171,7 @@
if (!options)
return 0;

- while (opt = strsep(&options, ",")) {
+ while ((opt = strsep(&options, ","))) {
if (!*opt)
continue;
value = strchr(opt, '=');
diff -ruN linux-2.4.13-rs/fs/affs/super.c linux-2.4.13-rs2/fs/affs/super.c
--- linux-2.4.13-rs/fs/affs/super.c Thu Oct 25 00:44:59 2001
+++ linux-2.4.13-rs2/fs/affs/super.c Thu Oct 25 22:34:26 2001
@@ -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;
diff -ruN linux-2.4.13-rs/fs/autofs/inode.c linux-2.4.13-rs2/fs/autofs/inode.c
--- linux-2.4.13-rs/fs/autofs/inode.c Thu Oct 25 00:44:59 2001
+++ linux-2.4.13-rs2/fs/autofs/inode.c Thu Oct 25 22:36:06 2001
@@ -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
--- linux-2.4.13-rs/fs/autofs4/inode.c Thu Oct 25 00:44:59 2001
+++ linux-2.4.13-rs2/fs/autofs4/inode.c Thu Oct 25 22:36:41 2001
@@ -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)
diff -ruN linux-2.4.13-rs/fs/devpts/inode.c linux-2.4.13-rs2/fs/devpts/inode.c
--- linux-2.4.13-rs/fs/devpts/inode.c Thu Oct 25 00:44:59 2001
+++ linux-2.4.13-rs2/fs/devpts/inode.c Thu Oct 25 22:36:32 2001
@@ -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)
diff -ruN linux-2.4.13-rs/fs/ext2/super.c linux-2.4.13-rs2/fs/ext2/super.c
--- linux-2.4.13-rs/fs/ext2/super.c Thu Oct 25 00:44:59 2001
+++ linux-2.4.13-rs2/fs/ext2/super.c Thu Oct 25 22:34:35 2001
@@ -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)
diff -ruN linux-2.4.13-rs/fs/fat/inode.c linux-2.4.13-rs2/fs/fat/inode.c
--- linux-2.4.13-rs/fs/fat/inode.c Thu Oct 25 00:44:59 2001
+++ linux-2.4.13-rs2/fs/fat/inode.c Thu Oct 25 22:33:25 2001
@@ -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;
diff -ruN linux-2.4.13-rs/fs/hfs/super.c linux-2.4.13-rs2/fs/hfs/super.c
--- linux-2.4.13-rs/fs/hfs/super.c Thu Oct 25 00:44:59 2001
+++ linux-2.4.13-rs2/fs/hfs/super.c Thu Oct 25 22:33:34 2001
@@ -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) {
diff -ruN linux-2.4.13-rs/fs/hpfs/super.c linux-2.4.13-rs2/fs/hpfs/super.c
--- linux-2.4.13-rs/fs/hpfs/super.c Thu Oct 25 00:44:59 2001
+++ linux-2.4.13-rs2/fs/hpfs/super.c Thu Oct 25 22:34:45 2001
@@ -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)
diff -ruN linux-2.4.13-rs/fs/isofs/inode.c linux-2.4.13-rs2/fs/isofs/inode.c
--- linux-2.4.13-rs/fs/isofs/inode.c Thu Oct 25 00:44:59 2001
+++ linux-2.4.13-rs2/fs/isofs/inode.c Thu Oct 25 22:35:25 2001
@@ -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) {
diff -ruN linux-2.4.13-rs/fs/nfs/nfsroot.c linux-2.4.13-rs2/fs/nfs/nfsroot.c
--- linux-2.4.13-rs/fs/nfs/nfsroot.c Thu Oct 25 00:44:59 2001
+++ linux-2.4.13-rs2/fs/nfs/nfsroot.c Thu Oct 25 22:33:48 2001
@@ -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, '='))) {
diff -ruN linux-2.4.13-rs/fs/ntfs/fs.c linux-2.4.13-rs2/fs/ntfs/fs.c
--- linux-2.4.13-rs/fs/ntfs/fs.c Thu Oct 25 00:44:59 2001
+++ linux-2.4.13-rs2/fs/ntfs/fs.c Thu Oct 25 22:34:52 2001
@@ -369,7 +369,7 @@

if (!opt)
goto done;
- while (opt = strsep(&options, ",")) {
+ while ((opt = strsep(&options, ","))) {
if (!*opt)
continue;
if ((value = strchr(opt, '=')) != NULL)
diff -ruN linux-2.4.13-rs/fs/proc/inode.c linux-2.4.13-rs2/fs/proc/inode.c
--- linux-2.4.13-rs/fs/proc/inode.c Thu Oct 25 00:44:59 2001
+++ linux-2.4.13-rs2/fs/proc/inode.c Thu Oct 25 22:35:01 2001
@@ -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
--- linux-2.4.13-rs/fs/reiserfs/super.c Thu Oct 25 00:44:59 2001
+++ linux-2.4.13-rs2/fs/reiserfs/super.c Thu Oct 25 22:35:17 2001
@@ -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)
diff -ruN linux-2.4.13-rs/fs/udf/super.c linux-2.4.13-rs2/fs/udf/super.c
--- linux-2.4.13-rs/fs/udf/super.c Thu Oct 25 00:44:59 2001
+++ linux-2.4.13-rs2/fs/udf/super.c Thu Oct 25 22:33:59 2001
@@ -218,7 +218,7 @@
if (!options)
return 1;

- while (opt = strsep(&options, ","))
+ while ((opt = strsep(&options, ",")))
{
if (!*opt)
continue;
diff -ruN linux-2.4.13-rs/fs/ufs/super.c linux-2.4.13-rs2/fs/ufs/super.c
--- linux-2.4.13-rs/fs/ufs/super.c Thu Oct 25 00:44:59 2001
+++ linux-2.4.13-rs2/fs/ufs/super.c Thu Oct 25 22:34:08 2001
@@ -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)
diff -ruN linux-2.4.13-rs/fs/vfat/namei.c linux-2.4.13-rs2/fs/vfat/namei.c
--- linux-2.4.13-rs/fs/vfat/namei.c Thu Oct 25 00:44:59 2001
+++ linux-2.4.13-rs2/fs/vfat/namei.c Thu Oct 25 22:35:09 2001
@@ -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;
diff -ruN linux-2.4.13-rs/mm/shmem.c linux-2.4.13-rs2/mm/shmem.c
--- linux-2.4.13-rs/mm/shmem.c Thu Oct 25 00:44:59 2001
+++ linux-2.4.13-rs2/mm/shmem.c Thu Oct 25 22:36:53 2001
@@ -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) {

2001-10-26 00:42:34

by Linus Torvalds

[permalink] [raw]
Subject: Re: [PATCH] strtok --> strsep in framebuffer drivers


On Thu, 25 Oct 2001, Ren? Scharfe wrote:
>
> 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

2001-10-26 17:30:20

by Roman Zippel

[permalink] [raw]
Subject: Re: [PATCH] strtok --> strsep in framebuffer drivers

Hi,

> diff -ur linux-2.4.13-pre5/drivers/video/virgefb.c
> linux-2.4.13-pre5-rs/drivers/video/virgefb.c
> --- linux-2.4.13-pre5/drivers/video/virgefb.c Fri Sep 14 01:04:43 2001
> +++ linux-2.4.13-pre5-rs/drivers/video/virgefb.c Sun Oct 21 13:02:11 2001
> @@ -1085,7 +1085,7 @@
> if (!options || !*options)
> return 0;
>
> - for (this_opt = strtok(options, ","); this_opt; this_opt = strtok(NULL,
> ","))
> + while (this_opt = strsep(&options, ",")) {
> if (!strcmp(this_opt, "inverse")) {
> Cyberfb_inverse = 1;
> fb_invert_cmaps();

You add a left brace here.

bye, Roman

2001-10-26 23:21:23

by Ren

[permalink] [raw]
Subject: Re: [PATCH] strtok --> strsep in framebuffer drivers

Am Freitag, 26. Oktober 2001 02:41 schrieben Sie:
> 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?


diff -ruN linux-2.4.14-pre2/drivers/video/virgefb.c linux-2.4.14-pre2-rs/drivers/video/virgefb.c
--- linux-2.4.14-pre2/drivers/video/virgefb.c Fri Oct 26 23:07:21 2001
+++ linux-2.4.14-pre2-rs/drivers/video/virgefb.c Fri Oct 26 23:33:08 2001
@@ -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,
diff -ruN linux-2.4.14-pre2/drivers/video/acornfb.c linux-2.4.14-pre2-rs/drivers/video/acornfb.c
--- linux-2.4.14-pre2/drivers/video/acornfb.c Fri Oct 26 23:07:21 2001
+++ linux-2.4.14-pre2-rs/drivers/video/acornfb.c Fri Oct 26 23:26:34 2001
@@ -1528,7 +1528,7 @@

acornfb_init_fbinfo();

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

diff -ruN linux-2.4.14-pre2/drivers/video/amifb.c linux-2.4.14-pre2-rs/drivers/video/amifb.c
--- linux-2.4.14-pre2/drivers/video/amifb.c Fri Oct 26 23:07:21 2001
+++ linux-2.4.14-pre2-rs/drivers/video/amifb.c Fri Oct 26 23:26:34 2001
@@ -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();
diff -ruN linux-2.4.14-pre2/drivers/video/atafb.c linux-2.4.14-pre2-rs/drivers/video/atafb.c
--- linux-2.4.14-pre2/drivers/video/atafb.c Fri Sep 14 01:04:43 2001
+++ linux-2.4.14-pre2-rs/drivers/video/atafb.c Fri Oct 26 23:26:34 2001
@@ -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;
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
--- linux-2.4.14-pre2/drivers/video/aty/atyfb_base.c Fri Oct 26 23:07:21 2001
+++ linux-2.4.14-pre2-rs/drivers/video/aty/atyfb_base.c Fri Oct 26 23:26:34 2001
@@ -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;
diff -ruN linux-2.4.14-pre2/drivers/video/aty128fb.c linux-2.4.14-pre2-rs/drivers/video/aty128fb.c
--- linux-2.4.14-pre2/drivers/video/aty128fb.c Fri Oct 26 23:07:21 2001
+++ linux-2.4.14-pre2-rs/drivers/video/aty128fb.c Fri Oct 26 23:26:34 2001
@@ -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;
diff -ruN linux-2.4.14-pre2/drivers/video/clgenfb.c linux-2.4.14-pre2-rs/drivers/video/clgenfb.c
--- linux-2.4.14-pre2/drivers/video/clgenfb.c Fri Oct 26 23:25:26 2001
+++ linux-2.4.14-pre2-rs/drivers/video/clgenfb.c Fri Oct 26 23:26:34 2001
@@ -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);
diff -ruN linux-2.4.14-pre2/drivers/video/controlfb.c linux-2.4.14-pre2-rs/drivers/video/controlfb.c
--- linux-2.4.14-pre2/drivers/video/controlfb.c Fri Oct 26 23:07:21 2001
+++ linux-2.4.14-pre2-rs/drivers/video/controlfb.c Fri Oct 26 23:26:34 2001
@@ -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;
diff -ruN linux-2.4.14-pre2/drivers/video/cyberfb.c linux-2.4.14-pre2-rs/drivers/video/cyberfb.c
--- linux-2.4.14-pre2/drivers/video/cyberfb.c Fri Oct 26 23:07:21 2001
+++ linux-2.4.14-pre2-rs/drivers/video/cyberfb.c Fri Oct 26 23:26:34 2001
@@ -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();
diff -ruN linux-2.4.14-pre2/drivers/video/fm2fb.c linux-2.4.14-pre2-rs/drivers/video/fm2fb.c
--- linux-2.4.14-pre2/drivers/video/fm2fb.c Fri Oct 26 23:07:21 2001
+++ linux-2.4.14-pre2-rs/drivers/video/fm2fb.c Fri Oct 26 23:26:34 2001
@@ -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))
diff -ruN linux-2.4.14-pre2/drivers/video/hgafb.c linux-2.4.14-pre2-rs/drivers/video/hgafb.c
--- linux-2.4.14-pre2/drivers/video/hgafb.c Fri Oct 26 23:07:21 2001
+++ linux-2.4.14-pre2-rs/drivers/video/hgafb.c Fri Oct 26 23:26:34 2001
@@ -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);
}
diff -ruN linux-2.4.14-pre2/drivers/video/igafb.c linux-2.4.14-pre2-rs/drivers/video/igafb.c
--- linux-2.4.14-pre2/drivers/video/igafb.c Fri Oct 26 23:07:21 2001
+++ linux-2.4.14-pre2-rs/drivers/video/igafb.c Fri Oct 26 23:26:34 2001
@@ -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;
diff -ruN linux-2.4.14-pre2/drivers/video/imsttfb.c linux-2.4.14-pre2-rs/drivers/video/imsttfb.c
--- linux-2.4.14-pre2/drivers/video/imsttfb.c Fri Oct 26 23:07:21 2001
+++ linux-2.4.14-pre2-rs/drivers/video/imsttfb.c Fri Oct 26 23:26:34 2001
@@ -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;
diff -ruN linux-2.4.14-pre2/drivers/video/macfb.c linux-2.4.14-pre2-rs/drivers/video/macfb.c
--- linux-2.4.14-pre2/drivers/video/macfb.c Fri Oct 26 23:07:21 2001
+++ linux-2.4.14-pre2-rs/drivers/video/macfb.c Fri Oct 26 23:26:34 2001
@@ -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"))
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
--- linux-2.4.14-pre2/drivers/video/matrox/matroxfb_base.c Fri Oct 26 23:07:21 2001
+++ linux-2.4.14-pre2-rs/drivers/video/matrox/matroxfb_base.c Fri Oct 26 23:26:34 2001
@@ -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);
diff -ruN linux-2.4.14-pre2/drivers/video/platinumfb.c linux-2.4.14-pre2-rs/drivers/video/platinumfb.c
--- linux-2.4.14-pre2/drivers/video/platinumfb.c Fri Oct 26 23:07:21 2001
+++ linux-2.4.14-pre2-rs/drivers/video/platinumfb.c Fri Oct 26 23:26:34 2001
@@ -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;
diff -ruN linux-2.4.14-pre2/drivers/video/radeonfb.c linux-2.4.14-pre2-rs/drivers/video/radeonfb.c
--- linux-2.4.14-pre2/drivers/video/radeonfb.c Fri Oct 26 23:25:26 2001
+++ linux-2.4.14-pre2-rs/drivers/video/radeonfb.c Fri Oct 26 23:26:34 2001
@@ -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;
diff -ruN linux-2.4.14-pre2/drivers/video/retz3fb.c linux-2.4.14-pre2-rs/drivers/video/retz3fb.c
--- linux-2.4.14-pre2/drivers/video/retz3fb.c Fri Oct 26 23:07:21 2001
+++ linux-2.4.14-pre2-rs/drivers/video/retz3fb.c Fri Oct 26 23:26:34 2001
@@ -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();
diff -ruN linux-2.4.14-pre2/drivers/video/riva/fbdev.c linux-2.4.14-pre2-rs/drivers/video/riva/fbdev.c
--- linux-2.4.14-pre2/drivers/video/riva/fbdev.c Fri Oct 26 23:07:21 2001
+++ linux-2.4.14-pre2-rs/drivers/video/riva/fbdev.c Fri Oct 26 23:26:34 2001
@@ -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;
diff -ruN linux-2.4.14-pre2/drivers/video/sa1100fb.c linux-2.4.14-pre2-rs/drivers/video/sa1100fb.c
--- linux-2.4.14-pre2/drivers/video/sa1100fb.c Fri Oct 26 23:25:26 2001
+++ linux-2.4.14-pre2-rs/drivers/video/sa1100fb.c Fri Oct 26 23:26:34 2001
@@ -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 =
diff -ruN linux-2.4.14-pre2/drivers/video/sgivwfb.c linux-2.4.14-pre2-rs/drivers/video/sgivwfb.c
--- linux-2.4.14-pre2/drivers/video/sgivwfb.c Fri Oct 26 23:07:21 2001
+++ linux-2.4.14-pre2-rs/drivers/video/sgivwfb.c Fri Oct 26 23:26:34 2001
@@ -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);
}
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
--- linux-2.4.14-pre2/drivers/video/sis/sis_main.c Fri Oct 26 23:25:26 2001
+++ linux-2.4.14-pre2-rs/drivers/video/sis/sis_main.c Fri Oct 26 23:26:34 2001
@@ -1725,7 +1725,7 @@
if (!options || !*options)
return 0;

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

diff -ruN linux-2.4.14-pre2/drivers/video/sstfb.c linux-2.4.14-pre2-rs/drivers/video/sstfb.c
--- linux-2.4.14-pre2/drivers/video/sstfb.c Fri Oct 26 23:07:21 2001
+++ linux-2.4.14-pre2-rs/drivers/video/sstfb.c Fri Oct 26 23:26:34 2001
@@ -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);
diff -ruN linux-2.4.14-pre2/drivers/video/tdfxfb.c linux-2.4.14-pre2-rs/drivers/video/tdfxfb.c
--- linux-2.4.14-pre2/drivers/video/tdfxfb.c Fri Oct 26 23:07:21 2001
+++ linux-2.4.14-pre2-rs/drivers/video/tdfxfb.c Fri Oct 26 23:26:34 2001
@@ -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();
diff -ruN linux-2.4.14-pre2/drivers/video/tgafb.c linux-2.4.14-pre2-rs/drivers/video/tgafb.c
--- linux-2.4.14-pre2/drivers/video/tgafb.c Fri Oct 26 23:07:21 2001
+++ linux-2.4.14-pre2-rs/drivers/video/tgafb.c Fri Oct 26 23:26:34 2001
@@ -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)) {
diff -ruN linux-2.4.14-pre2/drivers/video/valkyriefb.c linux-2.4.14-pre2-rs/drivers/video/valkyriefb.c
--- linux-2.4.14-pre2/drivers/video/valkyriefb.c Fri Oct 26 23:07:21 2001
+++ linux-2.4.14-pre2-rs/drivers/video/valkyriefb.c Fri Oct 26 23:26:34 2001
@@ -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;
diff -ruN linux-2.4.14-pre2/drivers/video/vesafb.c linux-2.4.14-pre2-rs/drivers/video/vesafb.c
--- linux-2.4.14-pre2/drivers/video/vesafb.c Fri Oct 26 23:07:21 2001
+++ linux-2.4.14-pre2-rs/drivers/video/vesafb.c Fri Oct 26 23:26:34 2001
@@ -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"))
diff -ruN linux-2.4.14-pre2/drivers/video/vfb.c linux-2.4.14-pre2-rs/drivers/video/vfb.c
--- linux-2.4.14-pre2/drivers/video/vfb.c Fri Oct 26 23:07:21 2001
+++ linux-2.4.14-pre2-rs/drivers/video/vfb.c Fri Oct 26 23:26:34 2001
@@ -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);
}
diff -ruN linux-2.4.14-pre2/drivers/video/vga16fb.c linux-2.4.14-pre2-rs/drivers/video/vga16fb.c
--- linux-2.4.14-pre2/drivers/video/vga16fb.c Fri Oct 26 23:07:21 2001
+++ linux-2.4.14-pre2-rs/drivers/video/vga16fb.c Fri Oct 26 23:26:34 2001
@@ -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))
diff -ruN linux-2.4.14-pre2/fs/adfs/super.c linux-2.4.14-pre2-rs/fs/adfs/super.c
--- linux-2.4.14-pre2/fs/adfs/super.c Fri Oct 26 23:25:26 2001
+++ linux-2.4.14-pre2-rs/fs/adfs/super.c Fri Oct 26 23:26:34 2001
@@ -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';
diff -ruN linux-2.4.14-pre2/fs/affs/super.c linux-2.4.14-pre2-rs/fs/affs/super.c
--- linux-2.4.14-pre2/fs/affs/super.c Tue Sep 11 17:19:35 2001
+++ linux-2.4.14-pre2-rs/fs/affs/super.c Fri Oct 26 23:26:34 2001
@@ -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;
diff -ruN linux-2.4.14-pre2/fs/autofs/inode.c linux-2.4.14-pre2-rs/fs/autofs/inode.c
--- linux-2.4.14-pre2/fs/autofs/inode.c Thu Jun 14 23:16:58 2001
+++ linux-2.4.14-pre2-rs/fs/autofs/inode.c Fri Oct 26 23:26:34 2001
@@ -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")) {
diff -ruN linux-2.4.14-pre2/fs/autofs4/inode.c linux-2.4.14-pre2-rs/fs/autofs4/inode.c
--- linux-2.4.14-pre2/fs/autofs4/inode.c Fri Feb 9 20:29:44 2001
+++ linux-2.4.14-pre2-rs/fs/autofs4/inode.c Fri Oct 26 23:26:34 2001
@@ -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")) {
diff -ruN linux-2.4.14-pre2/fs/devpts/inode.c linux-2.4.14-pre2-rs/fs/devpts/inode.c
--- linux-2.4.14-pre2/fs/devpts/inode.c Sun Sep 30 21:26:08 2001
+++ linux-2.4.14-pre2-rs/fs/devpts/inode.c Fri Oct 26 23:26:34 2001
@@ -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;
diff -ruN linux-2.4.14-pre2/fs/ext2/super.c linux-2.4.14-pre2-rs/fs/ext2/super.c
--- linux-2.4.14-pre2/fs/ext2/super.c Thu Oct 4 07:57:36 2001
+++ linux-2.4.14-pre2-rs/fs/ext2/super.c Fri Oct 26 23:26:34 2001
@@ -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"))
diff -ruN linux-2.4.14-pre2/fs/fat/inode.c linux-2.4.14-pre2-rs/fs/fat/inode.c
--- linux-2.4.14-pre2/fs/fat/inode.c Fri Oct 26 23:07:22 2001
+++ linux-2.4.14-pre2-rs/fs/fat/inode.c Fri Oct 26 23:26:34 2001
@@ -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;
diff -ruN linux-2.4.14-pre2/fs/hfs/super.c linux-2.4.14-pre2-rs/fs/hfs/super.c
--- linux-2.4.14-pre2/fs/hfs/super.c Wed Apr 18 08:16:39 2001
+++ linux-2.4.14-pre2-rs/fs/hfs/super.c Fri Oct 26 23:26:34 2001
@@ -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;
}
diff -ruN linux-2.4.14-pre2/fs/hpfs/super.c linux-2.4.14-pre2-rs/fs/hpfs/super.c
--- linux-2.4.14-pre2/fs/hpfs/super.c Tue Jun 12 04:15:27 2001
+++ linux-2.4.14-pre2-rs/fs/hpfs/super.c Fri Oct 26 23:26:34 2001
@@ -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;
diff -ruN linux-2.4.14-pre2/fs/isofs/inode.c linux-2.4.14-pre2-rs/fs/isofs/inode.c
--- linux-2.4.14-pre2/fs/isofs/inode.c Fri Oct 26 23:25:26 2001
+++ linux-2.4.14-pre2-rs/fs/isofs/inode.c Fri Oct 26 23:26:34 2001
@@ -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;
diff -ruN linux-2.4.14-pre2/fs/nfs/nfsroot.c linux-2.4.14-pre2-rs/fs/nfs/nfsroot.c
--- linux-2.4.14-pre2/fs/nfs/nfsroot.c Fri Jul 20 06:47:16 2001
+++ linux-2.4.14-pre2-rs/fs/nfs/nfsroot.c Fri Oct 26 23:26:34 2001
@@ -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")) {
diff -ruN linux-2.4.14-pre2/fs/ntfs/fs.c linux-2.4.14-pre2-rs/fs/ntfs/fs.c
--- linux-2.4.14-pre2/fs/ntfs/fs.c Fri Oct 26 23:07:22 2001
+++ linux-2.4.14-pre2-rs/fs/ntfs/fs.c Fri Oct 26 23:26:34 2001
@@ -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) {
diff -ruN linux-2.4.14-pre2/fs/proc/inode.c linux-2.4.14-pre2-rs/fs/proc/inode.c
--- linux-2.4.14-pre2/fs/proc/inode.c Sun Sep 30 21:26:08 2001
+++ linux-2.4.14-pre2-rs/fs/proc/inode.c Fri Oct 26 23:26:34 2001
@@ -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")) {
diff -ruN linux-2.4.14-pre2/fs/reiserfs/super.c linux-2.4.14-pre2-rs/fs/reiserfs/super.c
--- linux-2.4.14-pre2/fs/reiserfs/super.c Fri Oct 26 23:07:22 2001
+++ linux-2.4.14-pre2-rs/fs/reiserfs/super.c Fri Oct 26 23:26:34 2001
@@ -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")) {
diff -ruN linux-2.4.14-pre2/fs/udf/super.c linux-2.4.14-pre2-rs/fs/udf/super.c
--- linux-2.4.14-pre2/fs/udf/super.c Fri Oct 26 23:07:23 2001
+++ linux-2.4.14-pre2-rs/fs/udf/super.c Fri Oct 26 23:26:34 2001
@@ -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)
diff -ruN linux-2.4.14-pre2/fs/ufs/super.c linux-2.4.14-pre2-rs/fs/ufs/super.c
--- linux-2.4.14-pre2/fs/ufs/super.c Wed May 16 19:31:27 2001
+++ linux-2.4.14-pre2-rs/fs/ufs/super.c Fri Oct 26 23:26:34 2001
@@ -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")) {
diff -ruN linux-2.4.14-pre2/fs/vfat/namei.c linux-2.4.14-pre2-rs/fs/vfat/namei.c
--- linux-2.4.14-pre2/fs/vfat/namei.c Fri Oct 26 23:07:23 2001
+++ linux-2.4.14-pre2-rs/fs/vfat/namei.c Fri Oct 26 23:26:34 2001
@@ -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;
diff -ruN linux-2.4.14-pre2/mm/shmem.c linux-2.4.14-pre2-rs/mm/shmem.c
--- linux-2.4.14-pre2/mm/shmem.c Fri Oct 26 23:25:28 2001
+++ linux-2.4.14-pre2-rs/mm/shmem.c Fri Oct 26 23:26:34 2001
@@ -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 {

2001-10-27 19:51:02

by Ren

[permalink] [raw]
Subject: Re: [PATCH] strtok --> strsep in framebuffer drivers

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?



diff -ruN linux-2.4.14-pre2/drivers/video/virgefb.c linux-2.4.14-pre2-rs/drivers/video/virgefb.c
--- linux-2.4.14-pre2/drivers/video/virgefb.c Fri Oct 26 23:07:21 2001
+++ linux-2.4.14-pre2-rs/drivers/video/virgefb.c Fri Oct 26 23:33:08 2001
@@ -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,