Skip to content

Commit 1289b49

Browse files
committed
slash: fix strchr assignment type for glibc 2.43
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.
1 parent bf93fd3 commit 1289b49

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/slash.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ int slash_getopt(struct slash *slash, const char *opts)
6464
{
6565
/* From "public domain AT&T getopt source" newsgroup posting */
6666
int c;
67-
char *cp;
67+
const char *cp;
6868

6969
if (slash->sp == 1) {
7070
if (slash->optind >= slash->argc ||
@@ -471,8 +471,7 @@ static void slash_command_usage(struct slash *slash, struct slash_command *comma
471471

472472
static void slash_command_description(struct slash *slash, struct slash_command *command)
473473
{
474-
char *nl;
475-
const char *help = "";
474+
const char *nl, *help = "";
476475
size_t desclen = 0;
477476

478477
/* Extract first line from help as description */

0 commit comments

Comments
 (0)