* [PATCH] wireguard-tools: retain const qualifier from pointer
@ 2026-02-07 5:12 Rudi Heitbaum
0 siblings, 0 replies; only message in thread
From: Rudi Heitbaum @ 2026-02-07 5:12 UTC (permalink / raw)
To: wireguard; +Cc: rudi
Since glibc-2.43:
For ISO C23, the functions bsearch, memchr, strchr, strpbrk, strrchr,
strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr that return pointers
into their input arrays now have definitions as macros that return a
pointer to a const-qualified type when the in put argument is a pointer
to a const-qualified type.
https://lists.gnu.org/archive/html/info-gnu/2026-01/msg00005.html
Resolves the following warning:
config.c: In function 'config_read_line':
config.c:513:17: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
513 | comment = strchr(input, COMMENT_CHAR);
| ^
Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
---
src/config.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/config.c b/src/config.c
index 6b8aa58..cd65d7e 100644
--- a/src/config.c
+++ b/src/config.c
@@ -506,7 +506,8 @@ error:
bool config_read_line(struct config_ctx *ctx, const char *input)
{
size_t len, cleaned_len = 0;
- char *line, *comment;
+ const char *comment;
+ char *line;
bool ret = true;
/* This is what strchrnul is for, but that isn't portable. */
--
2.51.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-02-08 18:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-07 5:12 [PATCH] wireguard-tools: retain const qualifier from pointer Rudi Heitbaum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox