Home
memchr.c - scc - simple c99 compiler HTML git clone git://git.simple-cc.org/scc DIR Log DIR Files DIR Refs DIR Submodules DIR README DIR LICENSE --- memchr.c (197B) --- 1 #include <string.h> 2 3 #undef memchr 4 5 void * 6 memchr(const void *s, int c, size_t n) 7 { 8 unsigned char *bp = (unsigned char *) s; 9 10 while (n > 0 && *bp++ != c) 11 --n; 12 return (n == 0) ? NULL : bp-1; 13 }