Make some arguments that don't need to be modified const

A followup commit will use cmd_list_copy() with a const argument.
This commit is contained in:
David Mandelberg
2025-03-21 15:46:15 -04:00
parent c3c4524def
commit dbdc07e5ec
2 changed files with 4 additions and 4 deletions

4
cmd.c
View File

@@ -636,7 +636,7 @@ cmd_list_free(struct cmd_list *cmdlist)
/* Copy a command list, expanding %s in arguments. */ /* Copy a command list, expanding %s in arguments. */
struct cmd_list * struct cmd_list *
cmd_list_copy(struct cmd_list *cmdlist, int argc, char **argv) cmd_list_copy(const struct cmd_list *cmdlist, int argc, char **argv)
{ {
struct cmd *cmd; struct cmd *cmd;
struct cmd_list *new_cmdlist; struct cmd_list *new_cmdlist;
@@ -667,7 +667,7 @@ cmd_list_copy(struct cmd_list *cmdlist, int argc, char **argv)
/* Get a command list as a string. */ /* Get a command list as a string. */
char * char *
cmd_list_print(struct cmd_list *cmdlist, int escaped) cmd_list_print(const struct cmd_list *cmdlist, int escaped)
{ {
struct cmd *cmd, *next; struct cmd *cmd, *next;
char *buf, *this; char *buf, *this;

4
tmux.h
View File

@@ -2680,12 +2680,12 @@ struct cmd *cmd_copy(struct cmd *, int, char **);
void cmd_free(struct cmd *); void cmd_free(struct cmd *);
char *cmd_print(struct cmd *); char *cmd_print(struct cmd *);
struct cmd_list *cmd_list_new(void); struct cmd_list *cmd_list_new(void);
struct cmd_list *cmd_list_copy(struct cmd_list *, int, char **); struct cmd_list *cmd_list_copy(const struct cmd_list *, int, char **);
void cmd_list_append(struct cmd_list *, struct cmd *); void cmd_list_append(struct cmd_list *, struct cmd *);
void cmd_list_append_all(struct cmd_list *, struct cmd_list *); void cmd_list_append_all(struct cmd_list *, struct cmd_list *);
void cmd_list_move(struct cmd_list *, struct cmd_list *); void cmd_list_move(struct cmd_list *, struct cmd_list *);
void cmd_list_free(struct cmd_list *); void cmd_list_free(struct cmd_list *);
char *cmd_list_print(struct cmd_list *, int); char *cmd_list_print(const struct cmd_list *, int);
struct cmd *cmd_list_first(struct cmd_list *); struct cmd *cmd_list_first(struct cmd_list *);
struct cmd *cmd_list_next(struct cmd *); struct cmd *cmd_list_next(struct cmd *);
int cmd_list_all_have(struct cmd_list *, int); int cmd_list_all_have(struct cmd_list *, int);