lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 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 __USE_GNU |
| 11 | |
| 12 | #ifdef WANT_WIDE |
| 13 | # define Wstrnlen wcsnlen |
| 14 | #else |
| 15 | # define Wstrnlen strnlen |
| 16 | #endif |
| 17 | |
| 18 | size_t Wstrnlen(const Wchar *s, size_t max) |
| 19 | { |
| 20 | register const Wchar *p = s; |
| 21 | |
| 22 | while (max && *p) { |
| 23 | ++p; |
| 24 | --max; |
| 25 | } |
| 26 | |
| 27 | return p - s; |
| 28 | } |
| 29 | |
| 30 | libc_hidden_def(Wstrnlen) |
| 31 | #endif |