libdl: first execute all destructors, then munmap library
[uclibc-ng.git] / libc / string / memchr.c
blob99e13a2fc574482b2a06c88f4ab95c2fac2b9cd1
1 /*
2 * Copyright (C) 2002 Manuel Novoa III
3 * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
5 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
6 */
8 #include "_string.h"
10 #ifdef WANT_WIDE
11 # define Wmemchr wmemchr
12 #else
13 # undef memchr
14 # define Wmemchr memchr
15 #endif
17 Wvoid *Wmemchr(const Wvoid *s, Wint c, size_t n)
19 register const Wuchar *r = (const Wuchar *) s;
21 while (n) {
22 if (*r == ((Wuchar)c)) {
23 return (Wvoid *) r; /* silence the warning */
25 ++r;
26 --n;
29 return NULL;
32 libc_hidden_def(Wmemchr)