MCPcopy Create free account
hub / github.com/ElementsProject/lightning / utf8_check

Function utf8_check

ccan/ccan/utf8/test/run-encode-decode.c:7–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#include <assert.h>
6
7static bool utf8_check(const char *src, size_t len)
8{
9 bool decoded = false;
10 struct utf8_state utf8_state = UTF8_STATE_INIT;
11 size_t i;
12
13 for (i = 0; i < len; i++) {
14 decoded = utf8_decode(&utf8_state, src[i]);
15 if (decoded) {
16 if (errno != 0)
17 return false;
18 }
19 }
20 if (!decoded)
21 return false;
22 return true;
23}
24
25int main(int argc, char **argv)
26{

Callers 1

mainFunction · 0.70

Calls 1

utf8_decodeFunction · 0.85

Tested by

no test coverage detected