ConnMan network manager
 help / color / mirror / Atom feed
* [PATCH 3/5] gweb: Fix issue with const return value from memchr
@ 2026-02-12 13:26 Rudi Heitbaum
  0 siblings, 0 replies; only message in thread
From: Rudi Heitbaum @ 2026-02-12 13:26 UTC (permalink / raw)
  To: connman; +Cc: rudi

When compiling with recent gcc and glibc-2.43 the --Wdiscarded-qualifiers
warning occurs because with ISO C23, the function memchr that return
pointers into their input arrays now have definitions as macros that
return a pointer to a const-qualified type when the input argument is
a pointer to a const-qualified type.

../gweb/gweb.c: In function 'decode_chunked':
../gweb/gweb.c:1034:29: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
 1034 |                         pos = memchr(ptr, '\n', len);
      |                             ^
../gweb/gweb.c: In function 'g_web_parser_feed_data':                                                                              ../gweb/gweb.c:2922:29: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]            2922 |                         pos = memchr(ptr, chr, length);                                                                          |                             ^
---
 gweb/gweb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gweb/gweb.c b/gweb/gweb.c
index 4dbbb4c8..0a87da64 100644
--- a/gweb/gweb.c
+++ b/gweb/gweb.c
@@ -1025,7 +1025,7 @@ static int decode_chunked(struct web_session *session,
 	gsize counter;
 
 	while (len > 0) {
-		guint8 *pos;
+		const guint8 *pos;
 		gsize count;
 		char *str;
 
@@ -2917,7 +2917,7 @@ void g_web_parser_feed_data(GWebParser *parser,
 		guint8 chr = parser->token_str[parser->token_pos];
 
 		if (parser->token_pos == 0) {
-			guint8 *pos;
+			const guint8 *pos;
 
 			pos = memchr(ptr, chr, length);
 			if (!pos) {
-- 
2.51.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-02-12 13:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-12 13:26 [PATCH 3/5] gweb: Fix issue with const return value from memchr Rudi Heitbaum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox