From e128c7fcd8441f3fa885eafc9328f0937cc7384c Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 20 May 2019 11:46:06 +0000 Subject: Replace the various identical error callbacks with a single one in cmd-queue.c. --- cmd-command-prompt.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'cmd-command-prompt.c') diff --git a/cmd-command-prompt.c b/cmd-command-prompt.c index d7159ad0..a3cc22c8 100644 --- a/cmd-command-prompt.c +++ b/cmd-command-prompt.c @@ -129,17 +129,6 @@ cmd_command_prompt_exec(struct cmd *self, struct cmdq_item *item) return (CMD_RETURN_NORMAL); } -static enum cmd_retval -cmd_command_prompt_error(struct cmdq_item *item, void *data) -{ - char *error = data; - - cmdq_error(item, "%s", error); - free(error); - - return (CMD_RETURN_NORMAL); -} - static int cmd_command_prompt_callback(struct client *c, void *data, const char *s, int done) @@ -177,11 +166,11 @@ cmd_command_prompt_callback(struct client *c, void *data, const char *s, cmdlist = cmd_string_parse(new_template, NULL, 0, &cause); if (cmdlist == NULL) { - if (cause != NULL) { - new_item = cmdq_get_callback(cmd_command_prompt_error, - cause); - } else + if (cause != NULL) + new_item = cmdq_get_error(cause); + else new_item = NULL; + free(cause); } else { new_item = cmdq_get_command(cmdlist, NULL, NULL, 0); cmd_list_free(cmdlist); -- cgit v1.2.3