summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/cmd-attach-session.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2015-04-24 23:17:12 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2015-04-24 23:17:12 +0000
commit42f208ecc04cf6440525f861a8e584453096e7d8 (patch)
treeb4ac104eea31f3370212810894a607fef5705c76 /usr.bin/tmux/cmd-attach-session.c
parent3002403126d1fc845a49b01274f3316c6ac928c8 (diff)
Convert clients list into a TAILQ.
Diffstat (limited to 'usr.bin/tmux/cmd-attach-session.c')
-rw-r--r--usr.bin/tmux/cmd-attach-session.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/usr.bin/tmux/cmd-attach-session.c b/usr.bin/tmux/cmd-attach-session.c
index 71b7a03a2f8..4d6438efac9 100644
--- a/usr.bin/tmux/cmd-attach-session.c
+++ b/usr.bin/tmux/cmd-attach-session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-attach-session.c,v 1.32 2015/02/05 10:29:43 nicm Exp $ */
+/* $OpenBSD: cmd-attach-session.c,v 1.33 2015/04/24 23:17:11 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -51,7 +51,6 @@ cmd_attach_session(struct cmd_q *cmdq, const char *tflag, int dflag, int rflag,
struct window_pane *wp = NULL;
const char *update;
char *cause;
- u_int i;
int fd;
struct format_tree *ft;
char *cp;
@@ -92,11 +91,8 @@ cmd_attach_session(struct cmd_q *cmdq, const char *tflag, int dflag, int rflag,
* Can't use server_write_session in case attaching to
* the same session as currently attached to.
*/
- for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
- c = ARRAY_ITEM(&clients, i);
- if (c == NULL || c->session != s)
- continue;
- if (c == cmdq->client)
+ TAILQ_FOREACH(c, &clients, entry) {
+ if (c->session != s || c == cmdq->client)
continue;
server_write_client(c, MSG_DETACH,
c->session->name,