libroot_debug: Merge guarded heap into libroot_debug.
[haiku.git] / src / system / libroot / posix / string / memchr.c
blob442b0265568608dc66f16ac31cfeb9ec3a7a5b8c
1 /*
2 ** Copyright 2001, Manuel J. Petit. All rights reserved.
3 ** Distributed under the terms of the NewOS License.
4 */
6 #include <sys/types.h>
7 #include <string.h>
10 void *
11 memchr(void const *buf, int c, size_t len)
13 unsigned char const *b = buf;
14 unsigned char x = (c&0xff);
15 size_t i;
17 for (i = 0; i < len; i++) {
18 if (b[i] == x)
19 return (void*)(b + i);
22 return NULL;