From 5a3b3eba7e9aa84e6ddad3c81c1f503798856763 Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 2 Aug 2018 11:56:12 +0000 Subject: [PATCH] session_groups can be static also. --- usr.bin/tmux/server.c | 3 +-- usr.bin/tmux/session.c | 12 +++++------- usr.bin/tmux/tmux.h | 5 +---- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/usr.bin/tmux/server.c b/usr.bin/tmux/server.c index c3c39c31399..679bae889ef 100644 --- a/usr.bin/tmux/server.c +++ b/usr.bin/tmux/server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server.c,v 1.180 2018/03/08 08:09:10 nicm Exp $ */ +/* $OpenBSD: server.c,v 1.181 2018/08/02 11:56:12 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -202,7 +202,6 @@ server_start(struct tmuxproc *client, struct event_base *base, int lockfd, RB_INIT(&all_window_panes); TAILQ_INIT(&clients); RB_INIT(&sessions); - RB_INIT(&session_groups); key_bindings_init(); gettimeofday(&start_time, NULL); diff --git a/usr.bin/tmux/session.c b/usr.bin/tmux/session.c index e499d7b5a53..69cc0dbad75 100644 --- a/usr.bin/tmux/session.c +++ b/usr.bin/tmux/session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: session.c,v 1.79 2018/05/04 08:21:42 nicm Exp $ */ +/* $OpenBSD: session.c,v 1.80 2018/08/02 11:56:12 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -29,7 +29,7 @@ struct sessions sessions; static u_int next_session_id; -struct session_groups session_groups; +struct session_groups session_groups = RB_INITIALIZER(&session_groups); static void session_free(int, short, void *); @@ -41,21 +41,19 @@ static struct winlink *session_previous_alert(struct winlink *); static void session_group_remove(struct session *); static void session_group_synchronize1(struct session *, struct session *); -RB_GENERATE(sessions, session, entry, session_cmp); - int session_cmp(struct session *s1, struct session *s2) { return (strcmp(s1->name, s2->name)); } +RB_GENERATE(sessions, session, entry, session_cmp); -RB_GENERATE(session_groups, session_group, entry, session_group_cmp); - -int +static int session_group_cmp(struct session_group *s1, struct session_group *s2) { return (strcmp(s1->name, s2->name)); } +RB_GENERATE_STATIC(session_groups, session_group, entry, session_group_cmp); /* * Find if session is still alive. This is true if it is still on the global diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 5f5e93009d9..145125576c0 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.834 2018/08/02 11:44:07 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.835 2018/08/02 11:56:12 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -2281,11 +2281,8 @@ void control_notify_session_window_changed(struct session *); /* session.c */ extern struct sessions sessions; -extern struct session_groups session_groups; int session_cmp(struct session *, struct session *); RB_PROTOTYPE(sessions, session, entry, session_cmp); -int session_group_cmp(struct session_group *, struct session_group *); -RB_PROTOTYPE(session_groups, session_group, entry, session_group_cmp); int session_alive(struct session *); struct session *session_find(const char *); struct session *session_find_by_id_str(const char *); -- 2.20.1