d4bc9052be
For ape, we never enabled warnings in cflags. Turning it on brings up a lot of warnings. Most are noise, but a few caught unused variables and trunctaions of pointers. to smaller integers (int, long). A few warnings remain.
17 lines
200 B
C
17 lines
200 B
C
#include <string.h>
|
|
|
|
void*
|
|
memchr(const void *ap, int c, size_t n)
|
|
{
|
|
unsigned char *sp;
|
|
|
|
sp = (unsigned char*)ap;
|
|
c &= 0xFF;
|
|
while(n > 0) {
|
|
if(*sp++ == c)
|
|
return sp-1;
|
|
n--;
|
|
}
|
|
return 0;
|
|
}
|