]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
utf8: Remove the unused `codep` argument.
authorFlorian Forster <octo@collectd.org>
Fri, 22 Dec 2023 14:35:09 +0000 (15:35 +0100)
committerFlorian Forster <octo@collectd.org>
Thu, 28 Dec 2023 08:53:22 +0000 (09:53 +0100)
src/utils/utf8/utf8.c

index 3ffe6ab6c81fe4886ac259e9d05726bea389d670..68ce2f7fe9505391a35f3ba8e60b2f84ca717222 100644 (file)
@@ -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;