Skip to contentSkip to conversation

exterminate strtok - drivers/video/au1100fb.c

PATCH In review Jesper Juhl 2 participants 7 messages Aug 24, 2005 – Aug 29, 2005 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 exterminate strtok - drivers/video/au1100fb.c

Since strtok() died in 2002 let's not use it - use strsep() instead which is the replacement function.

Note: I've not been able to test this patch since I lack both hardware and a cross compiler, so if someone else could please check it and sign off on it before I send it to Andrew for inclusion in -mm I'd appreciate it.

---

 au1100fb.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
drivers/video/au1100fb.c +4 -3
@@ -614,7 +614,7 @@ void au1100fb_cleanup(struct fb_info *in
 
 void au1100fb_setup(char *options, int *ints)
 {
-	char* this_opt;
+	char *this_opt;
 	int i;
 	int num_panels = sizeof(panels)/sizeof(struct known_lcd_panels);
 
@@ -622,8 +622,9 @@ void au1100fb_setup(char *options, int *
 	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 (!strncmp(this_opt, "panel:", 6)) {
 #if defined(CONFIG_MIPS_PB1100) || defined(CONFIG_MIPS_DB1100)
 			/* Read Pb1100 Switch S10 ? */
#1 lore raw

I see the patch, or an equivalent, has been applied already.

Pete

Quoted 39 lines · Jesper Juhl

Since strtok() died in 2002 let's not use it - use strsep() instead which is the replacement function.

Note: I've not been able to test this patch since I lack both hardware and a cross compiler, so if someone else could please check it and sign off on it before I send it to Andrew for inclusion in -mm I'd appreciate it.

---

 au1100fb.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
drivers/video/au1100fb.c +4 -3
@@ -614,7 +614,7 @@ void au1100fb_cleanup(struct fb_info *in
 
 void au1100fb_setup(char *options, int *ints)
 {
-	char* this_opt;
+	char *this_opt;
 	int i;
 	int num_panels = sizeof(panels)/sizeof(struct known_lcd_panels);
 
@@ -622,8 +622,9 @@ void au1100fb_setup(char *options, int *
 	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 (!strncmp(this_opt, "panel:", 6)) {
 #if defined(CONFIG_MIPS_PB1100) || defined(CONFIG_MIPS_DB1100)
 			/* Read Pb1100 Switch S10 ? */
#2 lore raw
Quoted 3 lines · Pete Popov

I see the patch, or an equivalent, has been applied already.

Ohh, where? I don't see such a patch in 2.6.12-rc6-mm2 nor in 2.6.13.

Signature · 3 lines
Jesper Juhl <[email protected]>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html
#3 lore raw
Quoted 5 lines · Jesper Juhl
Quoted 3 lines · Pete Popov

I see the patch, or an equivalent, has been applied already.

Ohh, where? I don't see such a patch in 2.6.12-rc6-mm2 nor in 2.6.13.

2.6.13.

Pete

#4 lore raw
Quoted 9 lines · Pete Popov
Quoted 5 lines · Jesper Juhl
Quoted 3 lines · Pete Popov

I see the patch, or an equivalent, has been applied already.

Ohh, where? I don't see such a patch in 2.6.12-rc6-mm2 nor in 2.6.13.

2.6.13.

Then I must be blind, because I still see the old strtok() using code in there :

juhl@dragon:~/download/kernel/linux-2.6.13$ head -n 5 Makefile
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 13
EXTRAVERSION =
NAME=Woozy Numbat
juhl@dragon:~/download/kernel/linux-2.6.13$ grep -A 1 strtok
drivers/video/au1100fb.c
        for(this_opt=strtok(options, ","); this_opt;
            this_opt=strtok(NULL, ",")) {
                if (!strncmp(this_opt, "panel:", 6)) {

And the patch I created still applies just fine.

Signature · 3 lines
Jesper Juhl <[email protected]>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html
#5 lore raw
Quoted 2 lines

Then I must be blind, because I still see the old strtok() using code in there :

You must be looking at kernel.org. I'm talking about linux-mips. Any linux mips patches should go through linux-mips.org and Ralf eventually gets them into kernel.org.

Pete

Quoted 15 lines
juhl@dragon:~/download/kernel/linux-2.6.13$ head -n 5 Makefile
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 13
EXTRAVERSION =
NAME=Woozy Numbat
juhl@dragon:~/download/kernel/linux-2.6.13$ grep -A 1 strtok
drivers/video/au1100fb.c
        for(this_opt=strtok(options, ","); this_opt;
            this_opt=strtok(NULL, ",")) {
                if (!strncmp(this_opt, "panel:", 6)) {

And the patch I created still applies just fine.

#6 lore raw
Quoted 4 lines · Pete Popov
Quoted 2 lines

Then I must be blind, because I still see the old strtok() using code in there :

You must be looking at kernel.org. I'm talking about linux-mips. Any

Yes, I was looking at 2.6.13 from kernel.org.

Quoted 3 lines

linux mips patches should go through linux-mips.org and Ralf eventually gets them into kernel.org.

Ohh, ok. No problem then :)

Signature · 3 lines
Jesper Juhl <[email protected]>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html