aboutsummaryrefslogtreecommitdiff
path: root/lib/mbstring/u8chk.c
blob: 20c4f3f0ee11a740334b56591ae59e39bd3e0cb6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "rune.h"
#include "mbstring.h"

const char8_t *
u8chk(struct u8view sv)
{
	int w;
	rune ch;

	while (w = u8next(&ch, &sv)) {
		if (ch == RUNE_ERROR)
			return sv.p - w;
	}

	return nullptr;
}