From 233267a166b9d4432954a2dce1128be180c0f487 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Fri, 22 Dec 2023 15:35:09 +0100 Subject: [PATCH] utf8: Remove the unused `codep` argument. --- src/utils/utf8/utf8.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/utils/utf8/utf8.c b/src/utils/utf8/utf8.c index 3ffe6ab6c..68ce2f7fe 100644 --- a/src/utils/utf8/utf8.c +++ b/src/utils/utf8/utf8.c @@ -46,20 +46,17 @@ static const uint8_t utf8d[] = { }; // clang-format on -static void decode(uint32_t *state, uint32_t *codep, uint32_t byte) { +static void decode(uint32_t *state, uint32_t byte) { uint32_t type = utf8d[byte]; - *codep = (*state != UTF8_ACCEPT) ? (byte & 0x3fu) | (*codep << 6) - : (0xff >> type) & (byte); - *state = utf8d[256 + (*state) * 16 + type]; } bool utf8_valid(char const *s) { - uint32_t codepoint, state = 0; + uint32_t state = 0; for (size_t i = 0; s[i] != 0; i++) { - decode(&state, &codepoint, (uint8_t)s[i]); + decode(&state, (uint8_t)s[i]); } return state == UTF8_ACCEPT; -- 2.47.2