wireguard-tools: retain const qualifier from pointer
PATCH 1/1 wireguard-tools: retain const qualifier from pointer
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 <[email protected]>
--- src/config.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
src/config.c +2 -1
@@ -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. */
Signature · 1 line
2.51.0