From: William Lallemand Date: Wed, 7 Jan 2026 13:41:06 +0000 (+0100) Subject: BUILD: tools: memchr definition changed in C23 X-Git-Tag: v3.4-dev3~79 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4aff6d1c2550807fb67da56ad15fade8ab4a6d8d;p=thirdparty%2Fhaproxy.git BUILD: tools: memchr definition changed in C23 New gcc and clang versions from fedora rawhide seems to use the C23 standard by default. This version changes the definition of some string.h functions, which now return a const char * instead of a char *. src/tools.c: In function ‘fgets_from_mem’: src/tools.c:7200:17: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 7200 | new_pos = memchr(*position, '\n', size); | ^ Strangely, -Wdiscarded-qualifiers does not seem to catch all the memchr. Should fix issue #3228. This could be backported in previous versions. --- diff --git a/src/tools.c b/src/tools.c index 50101bc63..460a34e18 100644 --- a/src/tools.c +++ b/src/tools.c @@ -7182,7 +7182,7 @@ REGISTER_PER_THREAD_INIT(init_tools_per_thread); */ char *fgets_from_mem(char* buf, int size, const char **position, const char *end) { - char *new_pos; + const char *new_pos; int len = 0; /* keep fgets behaviour */