diff options
author | nicm <nicm> | 2017-07-21 09:17:19 +0000 |
---|---|---|
committer | nicm <nicm> | 2017-07-21 09:17:19 +0000 |
commit | 11e2af6df76e7384b4dcd20ea3b42ccba8e72310 (patch) | |
tree | 1563cfea3b94c7448d7a848b482b4978da0f66db /cmd-split-window.c | |
parent | 932f6cfbfc98ab2d6e593f7fa3473a6bb3269967 (diff) | |
download | rtmux-11e2af6df76e7384b4dcd20ea3b42ccba8e72310.tar.gz rtmux-11e2af6df76e7384b4dcd20ea3b42ccba8e72310.tar.bz2 rtmux-11e2af6df76e7384b4dcd20ea3b42ccba8e72310.zip |
Add -c for respawn-pane and respawn-window, from J Raynor.
Diffstat (limited to 'cmd-split-window.c')
-rw-r--r-- | cmd-split-window.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/cmd-split-window.c b/cmd-split-window.c index 4d94cd91..ad403196 100644 --- a/cmd-split-window.c +++ b/cmd-split-window.c @@ -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); } |