diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2015-06-19 18:41:54 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2015-06-19 18:41:54 +0000 |
commit | 4dd303de5bb47555c3acbdf5c53175c2e256249a (patch) | |
tree | 0e1175c202243117aa8b3ec1ef2e8582504f46d1 /lib/libc | |
parent | 908df8cd167fa20306cba34197d6b44785d97cef (diff) |
Remove needless casts. There's no reason to cast delim to char *
when we can just make spanp const char * to match it. OK deraadt@
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/string/strtok.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/libc/string/strtok.c b/lib/libc/string/strtok.c index 4e963a019e0..6ba6b21cd6f 100644 --- a/lib/libc/string/strtok.c +++ b/lib/libc/string/strtok.c @@ -40,11 +40,10 @@ strtok(char *s, const char *delim) char * strtok_r(char *s, const char *delim, char **last) { - char *spanp; + const char *spanp; int c, sc; char *tok; - if (s == NULL && (s = *last) == NULL) return (NULL); @@ -53,7 +52,7 @@ strtok_r(char *s, const char *delim, char **last) */ cont: c = *s++; - for (spanp = (char *)delim; (sc = *spanp++) != 0;) { + for (spanp = delim; (sc = *spanp++) != 0;) { if (c == sc) goto cont; } @@ -70,13 +69,13 @@ cont: */ for (;;) { c = *s++; - spanp = (char *)delim; + spanp = delim; do { if ((sc = *spanp++) == c) { if (c == 0) s = NULL; else - s[-1] = 0; + s[-1] = '\0'; *last = s; return (tok); } |