blob: e63aefe8ea1b2d2090856d6037382d289cbb196d (
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 = ap;
c &= 0xFF;
while(n > 0) {
if(*sp++ == c)
return sp-1;
n--;
}
return 0;
}
|