blob: 2e5e4cc7f20b977642af202c3b398042f0778e76 [file] [log] [blame]
/*
* memchr.c
*/
#include <stddef.h>
#include <string.h>
void *memchr(const void *s, int c, size_t n)
{
const unsigned char *sp = s;
while ( n-- ) {
if ( *sp == (unsigned char)c )
return (void *)sp;
sp++;
}
return NULL;
}