From 391070580534fdd4f082ccfe189211cbeeed8246 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Fri, 22 Dec 2023 14:38:28 +0100 Subject: [PATCH] utf8: Make utility build. * Import `"collectd.h"` for ``. * Make `decode` static, otherwise GCC complains about it reading from a static variable. --- Makefile.am | 5 ++++- src/utils/utf8/utf8.c | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 3c0f75b35..6d13d1ced 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 diff --git a/src/utils/utf8/utf8.c b/src/utils/utf8/utf8.c index c06abe4c0..fb6ead439 100644 --- a/src/utils/utf8/utf8.c +++ b/src/utils/utf8/utf8.c @@ -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) -- 2.47.2