diff options
author | millert <> | 2015-06-19 18:41:53 +0000 |
---|---|---|
committer | millert <> | 2015-06-19 18:41:53 +0000 |
commit | 423ea1a9bc2db6077e4924282a827eefbd2cdcd8 (patch) | |
tree | 16ed54592ebbe49d71ec58caa04b53c0f7a258d8 /src/lib | |
parent | 1884f88848338fd5650d7ac8131a2ceeeac6affb (diff) | |
download | openbsd-423ea1a9bc2db6077e4924282a827eefbd2cdcd8.tar.gz openbsd-423ea1a9bc2db6077e4924282a827eefbd2cdcd8.tar.bz2 openbsd-423ea1a9bc2db6077e4924282a827eefbd2cdcd8.zip |
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 'src/lib')
-rw-r--r-- | src/lib/libc/string/strtok.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/lib/libc/string/strtok.c b/src/lib/libc/string/strtok.c index 4e963a019e..6ba6b21cd6 100644 --- a/src/lib/libc/string/strtok.c +++ b/src/lib/libc/string/strtok.c | |||
@@ -40,11 +40,10 @@ strtok(char *s, const char *delim) | |||
40 | char * | 40 | char * |
41 | strtok_r(char *s, const char *delim, char **last) | 41 | strtok_r(char *s, const char *delim, char **last) |
42 | { | 42 | { |
43 | char *spanp; | 43 | const char *spanp; |
44 | int c, sc; | 44 | int c, sc; |
45 | char *tok; | 45 | char *tok; |
46 | 46 | ||
47 | |||
48 | if (s == NULL && (s = *last) == NULL) | 47 | if (s == NULL && (s = *last) == NULL) |
49 | return (NULL); | 48 | return (NULL); |
50 | 49 | ||
@@ -53,7 +52,7 @@ strtok_r(char *s, const char *delim, char **last) | |||
53 | */ | 52 | */ |
54 | cont: | 53 | cont: |
55 | c = *s++; | 54 | c = *s++; |
56 | for (spanp = (char *)delim; (sc = *spanp++) != 0;) { | 55 | for (spanp = delim; (sc = *spanp++) != 0;) { |
57 | if (c == sc) | 56 | if (c == sc) |
58 | goto cont; | 57 | goto cont; |
59 | } | 58 | } |
@@ -70,13 +69,13 @@ cont: | |||
70 | */ | 69 | */ |
71 | for (;;) { | 70 | for (;;) { |
72 | c = *s++; | 71 | c = *s++; |
73 | spanp = (char *)delim; | 72 | spanp = delim; |
74 | do { | 73 | do { |
75 | if ((sc = *spanp++) == c) { | 74 | if ((sc = *spanp++) == c) { |
76 | if (c == 0) | 75 | if (c == 0) |
77 | s = NULL; | 76 | s = NULL; |
78 | else | 77 | else |
79 | s[-1] = 0; | 78 | s[-1] = '\0'; |
80 | *last = s; | 79 | *last = s; |
81 | return (tok); | 80 | return (tok); |
82 | } | 81 | } |