summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2016-03-01 12:06:08 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2016-03-01 12:06:08 +0000
commiteb67c6d88c76e2dfb3ea4dcb1dca546a5ae9872b (patch)
treeb835aa252fb56a0631a3c8eb0e8c5f9862f9c7ce
parenta381372e4d6bd1c30f08a7239b3e7b394fe9959b (diff)
Remove some more unused variables, and use RB_FOREACH_SAFE in
key_bindings_unref_table.
-rw-r--r--usr.bin/tmux/cmd-if-shell.c5
-rw-r--r--usr.bin/tmux/cmd-resize-pane.c3
-rw-r--r--usr.bin/tmux/cmd.c3
-rw-r--r--usr.bin/tmux/key-bindings.c6
4 files changed, 7 insertions, 10 deletions
diff --git a/usr.bin/tmux/cmd-if-shell.c b/usr.bin/tmux/cmd-if-shell.c
index 489353f2675..902264c2415 100644
--- a/usr.bin/tmux/cmd-if-shell.c
+++ b/usr.bin/tmux/cmd-if-shell.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-if-shell.c,v 1.40 2015/12/14 00:31:54 nicm Exp $ */
+/* $OpenBSD: cmd-if-shell.c,v 1.41 2016/03/01 12:06:07 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -73,14 +73,13 @@ cmd_if_shell_exec(struct cmd *self, struct cmd_q *cmdq)
struct format_tree *ft;
const char *cwd;
- cwd = wp->cwd;
-
if (cmdq->client != NULL && cmdq->client->session == NULL)
cwd = cmdq->client->cwd;
else if (s != NULL)
cwd = s->cwd;
else
cwd = NULL;
+
ft = format_create(cmdq, 0);
format_defaults(ft, NULL, s, wl, wp);
shellcmd = format_expand(ft, args->argv[0]);
diff --git a/usr.bin/tmux/cmd-resize-pane.c b/usr.bin/tmux/cmd-resize-pane.c
index 2229565df02..0937e8ee731 100644
--- a/usr.bin/tmux/cmd-resize-pane.c
+++ b/usr.bin/tmux/cmd-resize-pane.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-resize-pane.c,v 1.22 2016/01/19 15:59:12 nicm Exp $ */
+/* $OpenBSD: cmd-resize-pane.c,v 1.23 2016/03/01 12:06:07 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -68,7 +68,6 @@ cmd_resize_pane_exec(struct cmd *self, struct cmd_q *cmdq)
return (CMD_RETURN_NORMAL);
}
- w = wl->window;
if (args_has(args, 'Z')) {
if (w->flags & WINDOW_ZOOMED)
window_unzoom(w);
diff --git a/usr.bin/tmux/cmd.c b/usr.bin/tmux/cmd.c
index e09e01c9d26..c571795f89f 100644
--- a/usr.bin/tmux/cmd.c
+++ b/usr.bin/tmux/cmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd.c,v 1.121 2016/01/19 16:01:30 nicm Exp $ */
+/* $OpenBSD: cmd.c,v 1.122 2016/03/01 12:06:07 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -482,7 +482,6 @@ cmd_prepare_state_flag(char c, const char *target, enum cmd_entry_flag flag,
CMD_FIND_SESSION, CMD_FIND_QUIET);
if (error == 0)
break;
- flag = CMD_WINDOW_INDEX;
/* FALLTHROUGH */
case CMD_WINDOW:
case CMD_WINDOW_CANFAIL:
diff --git a/usr.bin/tmux/key-bindings.c b/usr.bin/tmux/key-bindings.c
index c318db52e34..417bcd44a25 100644
--- a/usr.bin/tmux/key-bindings.c
+++ b/usr.bin/tmux/key-bindings.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: key-bindings.c,v 1.56 2016/01/19 15:59:12 nicm Exp $ */
+/* $OpenBSD: key-bindings.c,v 1.57 2016/03/01 12:06:07 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -68,12 +68,12 @@ void
key_bindings_unref_table(struct key_table *table)
{
struct key_binding *bd;
+ struct key_binding *bd1;
if (--table->references != 0)
return;
- while (!RB_EMPTY(&table->key_bindings)) {
- bd = RB_ROOT(&table->key_bindings);
+ RB_FOREACH_SAFE(bd, key_bindings, &table->key_bindings, bd1) {
RB_REMOVE(key_bindings, &table->key_bindings, bd);
cmd_list_free(bd->cmdlist);
free(bd);