summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-command-prompt.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2019-05-20 11:46:06 +0000
committernicm <nicm@openbsd.org>2019-05-20 11:46:06 +0000
commit0f3d1a91ca8aa75d7fe08275ad88a34052712685 (patch)
treee3dd22800fc81d9ef941b1324c2e93e83e95a5a2 /usr.bin/tmux/cmd-command-prompt.c
parentAdd a helper to allocate a cmd_list. (diff)
downloadwireguard-openbsd-0f3d1a91ca8aa75d7fe08275ad88a34052712685.tar.xz
wireguard-openbsd-0f3d1a91ca8aa75d7fe08275ad88a34052712685.zip
Replace the various identical error callbacks with a single one in cmd-queue.c.
Diffstat (limited to 'usr.bin/tmux/cmd-command-prompt.c')
-rw-r--r--usr.bin/tmux/cmd-command-prompt.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/usr.bin/tmux/cmd-command-prompt.c b/usr.bin/tmux/cmd-command-prompt.c
index e44c7d5caf4..909a537e153 100644
--- a/usr.bin/tmux/cmd-command-prompt.c
+++ b/usr.bin/tmux/cmd-command-prompt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-command-prompt.c,v 1.44 2017/05/17 15:20:23 nicm Exp $ */
+/* $OpenBSD: cmd-command-prompt.c,v 1.45 2019/05/20 11:46:06 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -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);