diff options
Diffstat (limited to 'nsprpub/lib/libc/src/strtok.c')
-rw-r--r-- | nsprpub/lib/libc/src/strtok.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/nsprpub/lib/libc/src/strtok.c b/nsprpub/lib/libc/src/strtok.c index 2daaea36c..df404494f 100644 --- a/nsprpub/lib/libc/src/strtok.c +++ b/nsprpub/lib/libc/src/strtok.c @@ -14,21 +14,24 @@ PL_strtok_r(char *s1, const char *s2, char **lasts) if( s1 == NULL ) { - if( *lasts == NULL ) + if( *lasts == NULL ) { return NULL; + } s1 = *lasts; } - + for( ; (c = *s1) != 0; s1++ ) { for( sepp = s2 ; (sc = *sepp) != 0 ; sepp++ ) { - if( c == sc ) + if( c == sc ) { break; + } + } + if( sc == 0 ) { + break; } - if( sc == 0 ) - break; } if( c == 0 ) @@ -36,7 +39,7 @@ PL_strtok_r(char *s1, const char *s2, char **lasts) *lasts = NULL; return NULL; } - + tok = s1++; for( ; (c = *s1) != 0; s1++ ) |