scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

memchr.c (187B)


      1 #include <string.h>
      2 #undef memchr
      3 
      4 void *
      5 memchr(const void *s, int c, size_t n)
      6 {
      7 	unsigned char *bp = (char *) s;
      8 
      9 	while (n > 0 && *bp++ != c)
     10 		--n;
     11 	return (n == 0) ? NULL : bp-1;
     12 }