From e595be6530588aac8f3748ba8e9ff8ac9030c1e5 Mon Sep 17 00:00:00 2001 From: Jeppe Ledet-Pedersen Date: Mon, 16 Mar 2026 13:39:03 +0100 Subject: [PATCH] slash: fix strchr assignment type for glibc 2.43 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Compiling with glibc 2.43 will create warnings if the the string pointer argument to strchr does not match the assignment type: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] Fix two instances where we called strchr with a const char pointer argument and assigned the return value to a non-const char pointer. The returned pointers were only read, so the functionality is the same. --- src/slash.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/slash.c b/src/slash.c index 1498381..5b5b7a1 100644 --- a/src/slash.c +++ b/src/slash.c @@ -64,7 +64,7 @@ int slash_getopt(struct slash *slash, const char *opts) { /* From "public domain AT&T getopt source" newsgroup posting */ int c; - char *cp; + const char *cp; if (slash->sp == 1) { if (slash->optind >= slash->argc || @@ -471,8 +471,7 @@ static void slash_command_usage(struct slash *slash, struct slash_command *comma static void slash_command_description(struct slash *slash, struct slash_command *command) { - char *nl; - const char *help = ""; + const char *nl, *help = ""; size_t desclen = 0; /* Extract first line from help as description */