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

Function utf8_check

ccan/ccan/utf8/test/run-decode.c:80–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80static int utf8_check(const char *src, size_t len)
81{
82 bool decoded = false;
83 struct utf8_state utf8_state = UTF8_STATE_INIT;
84 size_t i;
85
86 for (i = 0; i < len; i++) {
87 decoded = utf8_decode(&utf8_state, src[i]);
88 if (decoded) {
89 if (errno != 0)
90 return errno;
91 }
92 }
93 if (!decoded)
94 return EMLINK;
95 return 0;
96}
97
98static void
99test_utf8(const char *src, size_t len, int exp_err, unsigned line) {

Callers 1

test_utf8Function · 0.70

Calls 1

utf8_decodeFunction · 0.85

Tested by

no test coverage detected