aboutsummaryrefslogtreecommitdiff
path: root/lib/mbstring/u8cspn.c
blob: 827373f1bed47734a95a92633d73554dbf93ae35 (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(struct u8view sv, const rune *p, size_t n)
{
	rune ch;
	size_t k, w;

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

found:
	return k;
}