MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / str_utf8_validate

Function str_utf8_validate

src/util/strutil.c:33–52  ·  view source on GitHub ↗

return true if utf8 string is valid

Source from the content-addressed store, hash-verified

31
32// return true if utf8 string is valid
33bool str_utf8_validate
34(
35 const char *str
36) {
37 // hold current Unicode character
38 utf8proc_int32_t c;
39
40 // while we didn't get to the end of the string
41 while(str[0] != 0) {
42 // increment current position by number of bytes in Unicode character
43 str += utf8proc_iterate((const utf8proc_uint8_t *)str, -1, &c);
44 if(c == -1) {
45 // string is not valid
46 return false;
47 }
48 }
49
50 // string is valid
51 return true;
52}
53
54// determine the length of the string
55// not in terms of the number of bytes in the string

Callers 1

AR_REPLACEFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected