From 6ec57271b6dd7d042158ea7f4e4e87a7cfc6f14f Mon Sep 17 00:00:00 2001 From: Carl Smedstad Date: Fri, 30 Dec 2022 08:22:46 +0100 Subject: [PATCH] Make cmd_handler.command const --- include/sway/commands.h | 4 ++-- sway/commands.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/sway/commands.h b/include/sway/commands.h index 123a7245..fc6ce22e 100644 --- a/include/sway/commands.h +++ b/include/sway/commands.h @@ -9,7 +9,7 @@ struct sway_container; typedef struct cmd_results *sway_cmd(int argc, char **argv); struct cmd_handler { - char *command; + const char *command; sway_cmd *handle; }; @@ -46,7 +46,7 @@ enum expected_args { struct cmd_results *checkarg(int argc, const char *name, enum expected_args type, int val); -const struct cmd_handler *find_handler(char *line, +const struct cmd_handler *find_handler(const char *line, const struct cmd_handler *cmd_handlers, size_t handlers_size); /** diff --git a/sway/commands.c b/sway/commands.c index 041da7ea..28e9d8d2 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -148,7 +148,7 @@ static int handler_compare(const void *_a, const void *_b) { return strcasecmp(a->command, b->command); } -const struct cmd_handler *find_handler(char *line, +const struct cmd_handler *find_handler(const char *line, const struct cmd_handler *handlers, size_t handlers_size) { if (!handlers || !handlers_size) { return NULL;