blob: f1947fb0b0aa3481b24d959f553dceb254324d96 [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;
}