diff options
author | 2010-12-21 22:37:59 +0000 | |
---|---|---|
committer | 2010-12-21 22:37:59 +0000 | |
commit | 59996dc35714e4fdeb7a2e42e211b40dc98f8665 (patch) | |
tree | 52a9f2d8749b92976dd675f56f20a66ec181d4c2 /usr.bin/tmux/resize.c | |
parent | remove dead code (ivp did always point to iv in the decrypt path). (diff) | |
download | wireguard-openbsd-59996dc35714e4fdeb7a2e42e211b40dc98f8665.tar.xz wireguard-openbsd-59996dc35714e4fdeb7a2e42e211b40dc98f8665.zip |
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 'usr.bin/tmux/resize.c')
-rw-r--r-- | usr.bin/tmux/resize.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/usr.bin/tmux/resize.c b/usr.bin/tmux/resize.c index c0d243106cb..14b3ff433b0 100644 --- a/usr.bin/tmux/resize.c +++ b/usr.bin/tmux/resize.c @@ -1,4 +1,4 @@ -/* $OpenBSD: resize.c,v 1.6 2010/11/22 21:13:13 nicm Exp $ */ +/* $OpenBSD: resize.c,v 1.7 2010/12/21 22:37:59 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -52,11 +52,7 @@ recalculate_sizes(void) u_int i, j, ssx, ssy, has, limit; int flag; - for (i = 0; i < ARRAY_LENGTH(&sessions); i++) { - s = ARRAY_ITEM(&sessions, i); - if (s == NULL) - continue; - + RB_FOREACH(s, sessions, &sessions) { ssx = ssy = UINT_MAX; for (j = 0; j < ARRAY_LENGTH(&clients); j++) { c = ARRAY_ITEM(&clients, j); @@ -98,9 +94,8 @@ recalculate_sizes(void) flag = options_get_number(&w->options, "aggressive-resize"); ssx = ssy = UINT_MAX; - for (j = 0; j < ARRAY_LENGTH(&sessions); j++) { - s = ARRAY_ITEM(&sessions, j); - if (s == NULL || s->flags & SESSION_UNATTACHED) + RB_FOREACH(s, sessions, &sessions) { + if (s->flags & SESSION_UNATTACHED) continue; if (flag) has = s->curw->window == w; |