| 78 | } |
| 79 | |
| 80 | static 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 | |
| 98 | static void |
| 99 | test_utf8(const char *src, size_t len, int exp_err, unsigned line) { |
no test coverage detected