summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2012-08-14 08:15:01 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2012-08-14 08:15:01 +0000
commit080f2332adb566a0e80956c14a3951edf11367ac (patch)
tree0fd8bf8d34c7cb315f81cb90553307bd6562b8aa /usr.bin
parent2016b9b991db2b995a0b19a011def9ea355f2fc2 (diff)
Add a patch missed during a merge sometime to use
TAILQ_FOREACH_SAFE. From Tiago Cunha.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/cmd-kill-pane.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/usr.bin/tmux/cmd-kill-pane.c b/usr.bin/tmux/cmd-kill-pane.c
index 0eb304a4fd4..ce4688b34f8 100644
--- a/usr.bin/tmux/cmd-kill-pane.c
+++ b/usr.bin/tmux/cmd-kill-pane.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-kill-pane.c,v 1.11 2012/07/11 07:10:15 nicm Exp $ */
+/* $OpenBSD: cmd-kill-pane.c,v 1.12 2012/08/14 08:15:00 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -43,7 +43,7 @@ cmd_kill_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct args *args = self->args;
struct winlink *wl;
- struct window_pane *loopwp, *nextwp, *wp;
+ struct window_pane *loopwp, *tmpwp, *wp;
if ((wl = cmd_find_pane(ctx, args_get(args, 't'), NULL, &wp)) == NULL)
return (CMD_RETURN_ERROR);
@@ -56,14 +56,11 @@ cmd_kill_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
}
if (args_has(self->args, 'a')) {
- loopwp = TAILQ_FIRST(&wl->window->panes);
- while (loopwp != NULL) {
- nextwp = TAILQ_NEXT(loopwp, entry);
- if (loopwp != wp) {
- layout_close_pane(loopwp);
- window_remove_pane(wl->window, loopwp);
- }
- loopwp = nextwp;
+ TAILQ_FOREACH_SAFE(loopwp, &wl->window->panes, entry, tmpwp) {
+ if (loopwp == wp)
+ continue;
+ layout_close_pane(loopwp);
+ window_remove_pane(wl->window, loopwp);
}
} else {
layout_close_pane(wp);