]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/uclibc/lib/contrib/uclibc/libc/string/memchr.c
update
[l4.git] / l4 / pkg / uclibc / lib / contrib / uclibc / libc / string / memchr.c
1 /*
2  * Copyright (C) 2002     Manuel Novoa III
3  * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
4  *
5  * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
6  */
7
8 #include "_string.h"
9
10 #ifdef WANT_WIDE
11 # define Wmemchr wmemchr
12 #else
13 # undef memchr
14 # define Wmemchr memchr
15 #endif
16
17 Wvoid *Wmemchr(const Wvoid *s, Wint c, size_t n)
18 {
19         register const Wuchar *r = (const Wuchar *) s;
20
21         while (n) {
22                 if (*r == ((Wuchar)c)) {
23                         return (Wvoid *) r;     /* silence the warning */
24                 }
25                 ++r;
26                 --n;
27         }
28
29         return NULL;
30 }
31
32 libc_hidden_def(Wmemchr)