reactos/sdk/lib/crt/mem/memchr.c
2021-07-11 21:45:29 +02:00

19 lines
319 B
C

#include <string.h>
#if defined(_MSC_VER)
#pragma function(memchr)
#endif /* _MSC_VER */
void* __cdecl memchr(const void *s, int c, size_t n)
{
if (n)
{
const char *p = s;
do {
if (*p++ == c)
return (void *)(p-1);
} while (--n != 0);
}
return 0;
}