]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
utf8: Make utility build.
authorFlorian Forster <octo@collectd.org>
Fri, 22 Dec 2023 13:38:28 +0000 (14:38 +0100)
committerFlorian Forster <octo@collectd.org>
Thu, 28 Dec 2023 08:53:22 +0000 (09:53 +0100)
*   Import `"collectd.h"` for `<stdint.h>`.
*   Make `decode` static, otherwise GCC complains about it reading from a
    static variable.

Makefile.am
src/utils/utf8/utf8.c

index 3c0f75b35c9c755d525787e2f877546849057149..6d13d1ced0b28b71392fa6e788bf6729516a1b39 100644 (file)
@@ -141,7 +141,8 @@ noinst_LTLIBRARIES = \
        libmetric.la \
        libmount.la \
        liboconfig.la \
-       libstrbuf.la
+       libstrbuf.la \
+       libutf8.la
 
 
 check_LTLIBRARIES = \
@@ -635,6 +636,8 @@ liboconfig_la_SOURCES = \
 liboconfig_la_CPPFLAGS = -I$(srcdir)/src/liboconfig $(AM_CPPFLAGS)
 liboconfig_la_LDFLAGS = -avoid-version $(LEXLIB)
 
+libutf8_la_SOURCES = src/utils/utf8/utf8.c
+
 if BUILD_WITH_LIBCURL
 if BUILD_WITH_LIBSSL
 if BUILD_WITH_LIBYAJL2
index c06abe4c0cfd52f7d0657c75e7c0e8209a8f6564..fb6ead4395fcdb016e25bb8127d3c49f5e7065a6 100644 (file)
@@ -22,6 +22,8 @@
 
 // See http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for details.
 
+#include "collectd.h"
+
 #define UTF8_ACCEPT 0
 #define UTF8_REJECT 1
 
@@ -44,7 +46,7 @@ static const uint8_t utf8d[] = {
 };
 // clang-format on
 
-uint32_t inline decode(uint32_t *state, uint32_t *codep, uint32_t byte) {
+static uint32_t decode(uint32_t *state, uint32_t *codep, uint32_t byte) {
   uint32_t type = utf8d[byte];
 
   *codep = (*state != UTF8_ACCEPT) ? (byte & 0x3fu) | (*codep << 6)