libc: Fix strrchr
This commit is contained in:
parent
6953a28ce8
commit
5256166e7a
@ -136,8 +136,9 @@ extern "C"
|
|||||||
char* strrchr(const char* str, int c)
|
char* strrchr(const char* str, int c)
|
||||||
{
|
{
|
||||||
const char* s = str + strlen(str);
|
const char* s = str + strlen(str);
|
||||||
while (s != str && *str != (char)c) str--;
|
while (s != str && *s != (char)c) s--;
|
||||||
if (s != str) return const_cast<char*>(s);
|
if (s != str) return const_cast<char*>(s);
|
||||||
|
if (*s == (char)c) return const_cast<char*>(s);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user