Skip to contentSkip to conversation

strtok --> strsep in framebuffer drivers, last pieces (really!)

PATCH New René Scharfe 1 participant 1 message Nov 16, 2001 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 strtok --> strsep in framebuffer drivers, last pieces (really!)

Hi,

this seems to be the really last patch regarding strtok in framebuffer drivers'. It removes another compiler warning, converts the last three strtok()s to strsep()s and in two cases adds skip empty tokens'-code. Please, apply.

René

drivers/video/atafb.c +1 -1
diff -Nur linux-2.4.15-pre5/drivers/video/atafb.c linux-2.4.15-pre5-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 +2 -0
diff -Nur linux-2.4.15-pre5/drivers/video/aty/atyfb_base.c linux-2.4.15-pre5-rs/drivers/video/aty/atyfb_base.c
@@ -2522,6 +2522,8 @@
 	return 0;
 
     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 -Nur linux-2.4.15-pre5/drivers/video/aty128fb.c linux-2.4.15-pre5-rs/drivers/video/aty128fb.c
@@ -1620,7 +1620,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 -Nur linux-2.4.15-pre5/drivers/video/clgenfb.c linux-2.4.15-pre5-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/sis/sis_main.c +1 -2
diff -Nur linux-2.4.15-pre5/drivers/video/sis/sis_main.c linux-2.4.15-pre5-rs/drivers/video/sis/sis_main.c
@@ -2257,8 +2257,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;