am cb1df916: string: Fix wrong comparison semantics
* commit 'cb1df9161666db2a312814752de67fc623149a9b': string: Fix wrong comparison semantics
This commit is contained in:
commit
cb835cd77c
@ -34,7 +34,7 @@ char *
|
||||
index(const char *p, int ch)
|
||||
{
|
||||
for (;; ++p) {
|
||||
if (*p == ch)
|
||||
if (*p == (char) ch)
|
||||
return((char *)p);
|
||||
if (!*p)
|
||||
return((char *)NULL);
|
||||
|
@ -35,10 +35,10 @@ void *memrchr(const void *s, int c, size_t n)
|
||||
const char* q = p + n;
|
||||
|
||||
while (1) {
|
||||
q--; if (q < p || q[0] == c) break;
|
||||
q--; if (q < p || q[0] == c) break;
|
||||
q--; if (q < p || q[0] == c) break;
|
||||
q--; if (q < p || q[0] == c) break;
|
||||
q--; if (q < p || q[0] == (char) c) break;
|
||||
q--; if (q < p || q[0] == (char) c) break;
|
||||
q--; if (q < p || q[0] == (char) c) break;
|
||||
q--; if (q < p || q[0] == (char) c) break;
|
||||
}
|
||||
if (q >= p)
|
||||
return (void*)q;
|
||||
|
@ -34,7 +34,7 @@ char *
|
||||
strchr(const char *p, int ch)
|
||||
{
|
||||
for (;; ++p) {
|
||||
if (*p == ch)
|
||||
if (*p == (char) ch)
|
||||
return((char *)p);
|
||||
if (!*p)
|
||||
return((char *)NULL);
|
||||
|
@ -36,7 +36,7 @@ strrchr(const char *p, int ch)
|
||||
char *save;
|
||||
|
||||
for (save = NULL;; ++p) {
|
||||
if (*p == ch)
|
||||
if (*p == (char) ch)
|
||||
save = (char *)p;
|
||||
if (!*p)
|
||||
return(save);
|
||||
|
Loading…
x
Reference in New Issue
Block a user