aboutsummaryrefslogtreecommitdiff
path: root/lib/mbstring/u8chk.c
blob: bf9300567ba942a3c9d3f87037cd5c926bc5b45a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "mbstring.h"
#include "rune.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;
}