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