aboutsummaryrefslogtreecommitdiff
path: root/lib/mbstring/u8chk.c
blob: 332a4506475e4ff88f2dd66f7213ac7f0bd6b9eb (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(u8view_t sv)
{
	int w;
	rune ch;

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

	return nullptr;
}