blob: dbe440d66c565457d7125d54962cd2f798245f92 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#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;
}
|