summaryrefslogtreecommitdiff
path: root/riscv/riscv-probe/libfemto/std/memchr.c
blob: b8287ff512cb84c7c28c567e3e37ccd1b1a2081a (plain)
1
2
3
4
5
6
7
8
9
10
11
#include <string.h>

void *memchr(const void *s, int c, size_t n)
{
    unsigned char *p = (unsigned char *)s;
    while (n-- > 0) {
       if (*p == c) return p;
       p++;
    }
    return NULL;
}