summaryrefslogtreecommitdiffstats
path: root/tmux.h
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2010-12-21 22:37:59 +0000
committerNicholas Marriott <nicm@openbsd.org>2010-12-21 22:37:59 +0000
commitacf13ce9784111ca1e42ffc8206e752668476859 (patch)
tree49ccd47b2e589a27dab8657d516133205f07f393 /tmux.h
parent1b8488ee75458c4561089bf056c0e911de958428 (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 'tmux.h')
-rw-r--r--tmux.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/tmux.h b/tmux.h
index f5384773..075e581c 100644
--- a/tmux.h
+++ b/tmux.h
@@ -930,6 +930,8 @@ struct session_group {
TAILQ_HEAD(session_groups, session_group);
struct session {
+ u_int idx;
+
char *name;
char *cwd;
@@ -957,8 +959,10 @@ struct session {
int references;
TAILQ_ENTRY(session) gentry;
+ RB_ENTRY(session) entry;
};
-ARRAY_DECL(sessions, struct session *);
+RB_HEAD(sessions, session);
+ARRAY_DECL(sessionslist, struct session *);
/* TTY information. */
struct tty_key {
@@ -1967,13 +1971,15 @@ void clear_signals(int);
extern struct sessions sessions;
extern struct sessions dead_sessions;
extern struct session_groups session_groups;
+int session_cmp(struct session *, struct session *);
+RB_PROTOTYPE(sessions, session, entry, session_cmp);
int session_alive(struct session *);
struct session *session_find(const char *);
+struct session *session_find_by_index(u_int);
struct session *session_create(const char *, const char *, const char *,
struct environ *, struct termios *, int, u_int, u_int,
char **);
void session_destroy(struct session *);
-int session_index(struct session *, u_int *);
struct session *session_next_session(struct session *);
struct session *session_previous_session(struct session *);
struct winlink *session_new(struct session *,