mirror of
https://github.com/fluencelabs/musl
synced 2025-06-28 22:22:01 +00:00
implement memrchr (nonstandard) and optimize strrchr in terms of it
This commit is contained in:
@ -1,9 +1,8 @@
|
||||
#include <string.h>
|
||||
|
||||
void *__memrchr(const void *, int, size_t);
|
||||
|
||||
char *strrchr(const char *s, int c)
|
||||
{
|
||||
const char *p;
|
||||
c = (char)c;
|
||||
for (p=s+strlen(s); p>=s && *p!=c; p--);
|
||||
return p>=s ? (char *)p : 0;
|
||||
return __memrchr(s, c, strlen(s));
|
||||
}
|
||||
|
Reference in New Issue
Block a user