summaryrefslogtreecommitdiffstats
path: root/cmd-command-prompt.c
diff options
context:
space:
mode:
authornicm <nicm>2019-05-20 11:46:06 +0000
committernicm <nicm>2019-05-20 11:46:06 +0000
commite128c7fcd8441f3fa885eafc9328f0937cc7384c (patch)
tree2cd1ef8259cb2bcc22e52425d4515d2a7d1bd100 /cmd-command-prompt.c
parent8db89f8efba007bab51dd8b8979a828730892f56 (diff)
Replace the various identical error callbacks with a single one in cmd-queue.c.
Diffstat (limited to 'cmd-command-prompt.c')
-rw-r--r--cmd-command-prompt.c19
1 files changed, 4 insertions, 15 deletions
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);