Re: [PATCH] strtok -> strsep (The Easy Cases)

From: Rusty Russell (rusty@rustcorp.com.au)
Date: Fri May 04 2001 - 09:30:05 EST


In message <01050413055100.00907@golmepha> you write:
> Am Freitag, 4. Mai 2001 02:57 schrieb Rusty Russell:
> > There are two cases where the substitution is problematic:
>
> Yes, but...
>
> The cases which my patch modifies are of a different kind:

The very first hunk of your patch is wrong. I didn't check the
others. Note that the declaration of switches is:

    char switches[len+1];

--- linux-2.4.4/arch/m68k/atari/config.c Tue Nov 28 02:57:34 2000
+++ linux-2.4.4-rs/arch/m68k/atari/config.c Tue May 1 17:03:46 2001
@@ -206,13 +206,15 @@
 
     /* parse the options */
- for( p = strtok( switches, "," ); p; p = strtok( NULL, "," ) ) {
+ while( p = strsep( &switches, "," ) ) {
+ if (!*p)
+ continue;
         ovsc_shift = 0;
         if (strncmp( p, "ov_", 3 ) == 0) {
             p += 3;

Cheers,
Rusty.

--
Premature optmztion is rt of all evl. --DK
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon May 07 2001 - 21:00:20 EST