Bytes of the UTF-8 character that `lead` starts; 1 for anything else. */
| 254 | |
| 255 | /* Bytes of the UTF-8 character that `lead` starts; 1 for anything else. */ |
| 256 | static size_t pl_utf8_len(unsigned char lead) { |
| 257 | if (lead >= PL_UTF8_LEAD4 && lead < PL_UTF8_LEAD_END) { |
| 258 | return 4; |
| 259 | } |
| 260 | if (lead >= PL_UTF8_LEAD3 && lead < PL_UTF8_LEAD4) { |
| 261 | return 3; |
| 262 | } |
| 263 | if (lead >= PL_UTF8_LEAD2 && lead < PL_UTF8_LEAD3) { |
| 264 | return PAIR_LEN; |
| 265 | } |
| 266 | return SKIP_ONE; |
| 267 | } |
| 268 | |
| 269 | /* Append t[0, n): white-space runs become one space (none at the start), |
| 270 | * control bytes are dropped, and a character that does not fit whole ends |