Allow input to be NULL.

This commit is contained in:
Nicholas Marriott
2026-06-30 15:42:25 +01:00
parent eb2e26f4cd
commit 8908f50524
3 changed files with 7 additions and 7 deletions

View File

@@ -373,8 +373,12 @@ cmd_invoke_get(struct cmd_parse_tree *tree, struct cmdq_state *state,
struct cmd_invoke_state *is;
struct cmd_parse_node *root = cmd_parse_root(tree), *first;
struct cmdq_item *item;
struct cmd_invoke_input new_input = { 0 };
int i;
if (input == NULL)
input = &new_input;
is = xcalloc(1, sizeof *is);
is->references = 1;
is->tree = cmd_parse_add_ref(tree);

View File

@@ -674,7 +674,6 @@ key_bindings_init(void)
u_int i;
struct cmd_parse_tree *tree;
struct cmdq_item *new_item;
struct cmd_invoke_input ci = { 0 };
char *cause = NULL;
for (i = 0; i < nitems(defaults); i++) {
@@ -682,7 +681,7 @@ key_bindings_init(void)
if (tree == NULL)
fatalx("bad default key: %s", defaults[i]);
new_item = cmd_invoke_get(tree, NULL, &ci);
new_item = cmd_invoke_get(tree, NULL, NULL);
cmdq_append(NULL, new_item);
cmd_parse_free(tree);
}
@@ -702,7 +701,6 @@ key_bindings_dispatch(struct key_binding *bd, struct cmdq_item *item,
{
struct cmdq_item *new_item;
struct cmdq_state *new_state;
struct cmd_invoke_input ci;
int readonly, flags = 0;
if (c == NULL || (~c->flags & CLIENT_READONLY))
@@ -722,8 +720,7 @@ key_bindings_dispatch(struct key_binding *bd, struct cmdq_item *item,
flags |= CMDQ_STATE_REPEAT;
new_state = cmdq_new_state(fs, event, flags);
memset(&ci, 0, sizeof ci);
new_item = cmd_invoke_get(bd->cmd, new_state, &ci);
new_item = cmd_invoke_get(bd->cmd, new_state, NULL);
cmdq_free_state(new_state);
}
if (item != NULL)

View File

@@ -2579,7 +2579,6 @@ server_client_dispatch_command(struct client *c, struct imsg *imsg)
int argc = 0;
char **argv, *cause;
struct cmdq_item *item;
struct cmd_invoke_input ci = { 0 };
struct args_value *values;
struct cmd_parse_tree *tree;
@@ -2610,7 +2609,7 @@ server_client_dispatch_command(struct client *c, struct imsg *imsg)
free(values);
cmd_free_argv(argc, argv);
item = cmd_invoke_get(tree, NULL, &ci);
item = cmd_invoke_get(tree, NULL, NULL);
cmd_parse_free(tree);
}
cmdq_append(c, item);