Gabe Black | 1025f3a | 2011-09-16 02:18:56 -0700 | [diff] [blame] | 1 | #include <string.h> |
2 | void *memchr(const void *s, int c, size_t n) | ||||
3 | { | ||||
4 | const unsigned char *sc = s; | ||||
5 | while (n--) { | ||||
6 | if (*sc == (unsigned char)c) | ||||
7 | return (void *)sc; | ||||
8 | sc++; | ||||
9 | } | ||||
10 | return NULL; | ||||
11 | } |