True when s[0, n) is well-formed UTF-8. */
| 175 | |
| 176 | /* True when s[0, n) is well-formed UTF-8. */ |
| 177 | static bool cs_utf8_ok(const char *s, size_t n) { |
| 178 | for (size_t i = 0; i < n;) { |
| 179 | size_t l = cs_utf8_len((const unsigned char *)s + i, n - i); |
| 180 | if (l == 0) { |
| 181 | return false; |
| 182 | } |
| 183 | i += l; |
| 184 | } |
| 185 | return true; |
| 186 | } |
| 187 | |
| 188 | /* ── Doc-comment references ──────────────────────────────────────── */ |
| 189 |
no test coverage detected