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 /cmd-list-sessions.c | |
parent | 1b8488ee75458c4561089bf056c0e911de958428 (diff) | |
download | rtmux-acf13ce9784111ca1e42ffc8206e752668476859.tar.gz rtmux-acf13ce9784111ca1e42ffc8206e752668476859.tar.bz2 rtmux-acf13ce9784111ca1e42ffc8206e752668476859.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 'cmd-list-sessions.c')
-rw-r--r-- | cmd-list-sessions.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/cmd-list-sessions.c b/cmd-list-sessions.c index 774c599b..e7aa22d7 100644 --- a/cmd-list-sessions.c +++ b/cmd-list-sessions.c @@ -46,14 +46,10 @@ cmd_list_sessions_exec(unused struct cmd *self, struct cmd_ctx *ctx) struct session *s; struct session_group *sg; char *tim, tmp[64]; - u_int i, idx; + u_int idx; time_t t; - for (i = 0; i < ARRAY_LENGTH(&sessions); i++) { - s = ARRAY_ITEM(&sessions, i); - if (s == NULL) - continue; - + RB_FOREACH(s, sessions, &sessions) { sg = session_group_find(s); if (sg == NULL) *tmp = '\0'; |