diff options
author | Tiago Cunha <tcunha@gmx.com> | 2010-12-22 15:36:44 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2010-12-22 15:36:44 +0000 |
commit | a373235106d22fdead116d478087d8f8f11c150d (patch) | |
tree | 2f4aba9efa49f7855e918e095d13f6085f8d4d91 /resize.c | |
parent | 9f3399da001580aa8b2118bb38245c7c5f26e944 (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 'resize.c')
-rw-r--r-- | resize.c | 13 |
1 files changed, 4 insertions, 9 deletions
@@ -1,4 +1,4 @@ -/* $Id: resize.c,v 1.26 2010-12-06 21:57:56 nicm Exp $ */ +/* $Id: resize.c,v 1.27 2010-12-22 15:36:44 tcunha 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; |