xref: /haiku/src/system/libroot/posix/wchar/wcscspn.c (revision 47a21c5c89fc9fd155a3929e5a8f6056b92a2053)
1 /*
2 ** Copyright 2011, Oliver Tappe, zooey@hirschkaefer.de. All rights reserved.
3 ** Distributed under the terms of the MIT License.
4 */
5 
6 #include <wchar_private.h>
7 
8 
9 size_t
__wcscspn(const wchar_t * wcs,const wchar_t * rejectIn)10 __wcscspn(const wchar_t* wcs, const wchar_t* rejectIn)
11 {
12 	const wchar_t* wcPointer = wcs;
13 	wchar_t wc;
14 	for (; (wc = *wcPointer) != L'\0'; ++wcPointer) {
15 		const wchar_t* reject;
16 		for (reject = rejectIn; *reject != L'\0'; ++reject) {
17 			if (*reject == wc)
18 				return wcPointer - wcs;
19 		}
20 	}
21 
22 	return wcPointer - wcs;
23 }
24 
25 B_DEFINE_WEAK_ALIAS(__wcscspn, wcscspn);
26