summaryrefslogtreecommitdiffstats
path: root/cmd-rename-session.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2010-12-22 15:36:44 +0000
committerTiago Cunha <tcunha@gmx.com>2010-12-22 15:36:44 +0000
commita373235106d22fdead116d478087d8f8f11c150d (patch)
tree2f4aba9efa49f7855e918e095d13f6085f8d4d91 /cmd-rename-session.c
parent9f3399da001580aa8b2118bb38245c7c5f26e944 (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 'cmd-rename-session.c')
-rw-r--r--cmd-rename-session.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/cmd-rename-session.c b/cmd-rename-session.c
index 23fcd7f2..24b0acb5 100644
--- a/cmd-rename-session.c
+++ b/cmd-rename-session.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-rename-session.c,v 1.20 2010-08-11 22:19:03 tcunha Exp $ */
+/* $Id: cmd-rename-session.c,v 1.21 2010-12-22 15:36:44 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -53,8 +53,10 @@ cmd_rename_session_exec(struct cmd *self, struct cmd_ctx *ctx)
if ((s = cmd_find_session(ctx, data->target)) == NULL)
return (-1);
+ RB_REMOVE(sessions, &sessions, s);
xfree(s->name);
s->name = xstrdup(data->arg);
+ RB_INSERT(sessions, &sessions, s);
server_status_session(s);