From 68cb1c0e6b169c6765e0d52c5319fe4354edaf09 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 22 Oct 2014 23:11:41 +0000 Subject: Merge unlink-window into kill-window. --- session.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'session.c') diff --git a/session.c b/session.c index 3bc2363e..0f8c1122 100644 --- a/session.c +++ b/session.c @@ -492,6 +492,19 @@ session_group_remove(struct session *s) } } +/* Count number of sessions in session group. */ +u_int +session_group_count(struct session_group *sg) +{ + struct session *s; + u_int n; + + n = 0; + TAILQ_FOREACH(s, &sg->sessions, gentry) + n++; + return (n); +} + /* Synchronize a session to its session group. */ void session_group_synchronize_to(struct session *s) @@ -579,8 +592,9 @@ session_group_synchronize1(struct session *target, struct session *s) /* Then free the old winlinks list. */ while (!RB_EMPTY(&old_windows)) { wl = RB_ROOT(&old_windows); - if (winlink_find_by_window_id(&s->windows, wl->window->id) == NULL) - notify_window_unlinked(s, wl->window); + wl2 = winlink_find_by_window_id(&s->windows, wl->window->id); + if (wl2 == NULL) + notify_window_unlinked(s, wl->window); winlink_remove(&old_windows, wl); } } -- cgit From abfb9656ef4404cff7847032cd4722eb0af55ee3 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 22 Oct 2014 23:18:53 +0000 Subject: Fix some spacing nits. --- session.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'session.c') diff --git a/session.c b/session.c index 0f8c1122..03ddb10d 100644 --- a/session.c +++ b/session.c @@ -127,7 +127,7 @@ session_create(const char *name, int argc, char **argv, const char *path, s->name = NULL; do { s->id = next_session_id++; - free (s->name); + free(s->name); xasprintf(&s->name, "%u", s->id); } while (RB_FIND(sessions, &sessions, s) != NULL); } -- cgit