diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2010-12-21 22:37:59 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2010-12-21 22:37:59 +0000 |
commit | acf13ce9784111ca1e42ffc8206e752668476859 (patch) | |
tree | 49ccd47b2e589a27dab8657d516133205f07f393 /server-window.c | |
parent | 1b8488ee75458c4561089bf056c0e911de958428 (diff) |
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.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/server-window.c b/server-window.c index abf82499..d415e0d7 100644 --- a/server-window.c +++ b/server-window.c @@ -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; |