summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-split-window.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2017-07-21 09:17:19 +0000
committernicm <nicm@openbsd.org>2017-07-21 09:17:19 +0000
commit579ab1e83e50fb56f7976e518f5a43ff44aa49c8 (patch)
treefd581f60d8b3e16daf7010bc7f53e38235432920 /usr.bin/tmux/cmd-split-window.c
parentI'm equally upset as Kurt Mosiejczuk, who found irrelevant 22-year (diff)
downloadwireguard-openbsd-579ab1e83e50fb56f7976e518f5a43ff44aa49c8.tar.xz
wireguard-openbsd-579ab1e83e50fb56f7976e518f5a43ff44aa49c8.zip
Add -c for respawn-pane and respawn-window, from J Raynor.
Diffstat (limited to 'usr.bin/tmux/cmd-split-window.c')
-rw-r--r--usr.bin/tmux/cmd-split-window.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/usr.bin/tmux/cmd-split-window.c b/usr.bin/tmux/cmd-split-window.c
index 83490ab0dc6..02f0f6766dd 100644
--- a/usr.bin/tmux/cmd-split-window.c
+++ b/usr.bin/tmux/cmd-split-window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-split-window.c,v 1.85 2017/05/30 21:44:59 nicm Exp $ */
+/* $OpenBSD: cmd-split-window.c,v 1.86 2017/07/21 09:17:19 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -61,8 +61,8 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item)
struct window *w = wl->window;
struct window_pane *wp = item->target.wp, *new_wp = NULL;
struct environ *env;
- const char *cmd, *path, *shell, *template, *cwd, *to_free;
- char **argv, *cause, *new_cause, *cp;
+ const char *cmd, *path, *shell, *template, *cwd;
+ char **argv, *cause, *new_cause, *cp, *to_free = NULL;
u_int hlimit;
int argc, size, percentage;
enum layout_type type;
@@ -86,10 +86,10 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item)
argv = args->argv;
}
- to_free = NULL;
if (args_has(args, 'c')) {
cwd = args_get(args, 'c');
- to_free = cwd = format_single(item, cwd, c, s, NULL, NULL);
+ to_free = format_single(item, cwd, c, s, NULL, NULL);
+ cwd = to_free;
} else if (item->client != NULL && item->client->session == NULL)
cwd = item->client->cwd;
else
@@ -172,12 +172,10 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item)
}
notify_window("window-layout-changed", w);
- if (to_free != NULL)
- free((void *)to_free);
-
cmd_find_from_winlink_pane(&fs, wl, new_wp);
hooks_insert(s->hooks, item, &fs, "after-split-window");
+ free(to_free);
return (CMD_RETURN_NORMAL);
error:
@@ -188,7 +186,6 @@ error:
cmdq_error(item, "create pane failed: %s", cause);
free(cause);
- if (to_free != NULL)
- free((void *)to_free);
+ free(to_free);
return (CMD_RETURN_ERROR);
}