blob: 99e13a2fc574482b2a06c88f4ab95c2fac2b9cd1 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/*
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
17Wvoid *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
32libc_hidden_def(Wmemchr)