summaryrefslogtreecommitdiffstats
path: root/server-window.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2010-12-22 15:36:44 +0000
committerTiago Cunha <tcunha@gmx.com>2010-12-22 15:36:44 +0000
commita373235106d22fdead116d478087d8f8f11c150d (patch)
tree2f4aba9efa49f7855e918e095d13f6085f8d4d91 /server-window.c
parent9f3399da001580aa8b2118bb38245c7c5f26e944 (diff)
Sync OpenBSD patchset 806:
Store sessions in an RB tree by name rather than a list, this is tidier and allows them to easily be shown sorted in various lists (list-sessions/choose-sessions). Keep a session index which is used in a couple of places internally but make it an ever-increasing number rather than filling in gaps with new sessions.
Diffstat (limited to 'server-window.c')
-rw-r--r--server-window.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/server-window.c b/server-window.c
index 7f43a91e..b5daac5a 100644
--- a/server-window.c
+++ b/server-window.c
@@ -1,4 +1,4 @@
-/* $Id: server-window.c,v 1.18 2010-12-06 22:52:21 nicm Exp $ */
+/* $Id: server-window.c,v 1.19 2010-12-22 15:36:44 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -38,17 +38,14 @@ server_window_loop(void)
struct winlink *wl;
struct window_pane *wp;
struct session *s;
- u_int i, j;
+ u_int i;
for (i = 0; i < ARRAY_LENGTH(&windows); i++) {
w = ARRAY_ITEM(&windows, i);
if (w == NULL)
continue;
- for (j = 0; j < ARRAY_LENGTH(&sessions); j++) {
- s = ARRAY_ITEM(&sessions, j);
- if (s == NULL)
- continue;
+ RB_FOREACH(s, sessions, &sessions) {
wl = session_has(s, w);
if (wl == NULL)
continue;