}
/* count of characters used to encode one unicode char */
-static size_t utf8_encoded_expected_len(const char *str) {
- uint8_t c;
-
- assert(str);
-
- c = (uint8_t) str[0];
+static size_t utf8_encoded_expected_len(uint8_t c) {
if (c < 0x80)
return 1;
if ((c & 0xe0) == 0xc0)
assert(str);
- len = utf8_encoded_expected_len(str);
+ len = utf8_encoded_expected_len(str[0]);
switch (len) {
case 1:
char32_t unichar;
size_t e;
- e = utf8_encoded_expected_len(s + i);
+ e = utf8_encoded_expected_len(s[i]);
if (e <= 1) /* Invalid and single byte characters are copied as they are */
goto copy;
assert(str);
- len = utf8_encoded_expected_len(str);
+ len = utf8_encoded_expected_len(str[0]);
if (len == 0)
return -EINVAL;