aboutsummaryrefslogtreecommitdiff
path: root/lib/mbstring/u8cspn.c
blob: 4892de4f4dd2209aa2fa5fccf70a5d58518c45c8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "mbstring.h"

size_t
u8cspn(const char8_t *s, size_t n, const rune *p, size_t m)
{
	rune ch;
	size_t k, l;

	for (k = 0; (l = u8next(&ch, &s, &n)); k += l) {
		for (size_t i = 0; i < m; i++) {
			if (p[i] == ch)
				goto found;
		}
	}

found:
	return k;
}