session_groups can be static also.

This commit is contained in:
nicm 2018-08-02 11:56:12 +00:00
parent 6048b0f483
commit fb1f0fee5a
3 changed files with 9 additions and 18 deletions

View File

@ -202,7 +202,6 @@ server_start(struct tmuxproc *client, struct event_base *base, int lockfd,
RB_INIT(&all_window_panes); RB_INIT(&all_window_panes);
TAILQ_INIT(&clients); TAILQ_INIT(&clients);
RB_INIT(&sessions); RB_INIT(&sessions);
RB_INIT(&session_groups);
key_bindings_init(); key_bindings_init();
gettimeofday(&start_time, NULL); gettimeofday(&start_time, NULL);

View File

@ -29,7 +29,7 @@
struct sessions sessions; struct sessions sessions;
static u_int next_session_id; 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 *); 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_remove(struct session *);
static void session_group_synchronize1(struct session *, struct session *); static void session_group_synchronize1(struct session *, struct session *);
RB_GENERATE(sessions, session, entry, session_cmp);
int int
session_cmp(struct session *s1, struct session *s2) session_cmp(struct session *s1, struct session *s2)
{ {
return (strcmp(s1->name, s2->name)); return (strcmp(s1->name, s2->name));
} }
RB_GENERATE(sessions, session, entry, session_cmp);
RB_GENERATE(session_groups, session_group, entry, session_group_cmp); static int
int
session_group_cmp(struct session_group *s1, struct session_group *s2) session_group_cmp(struct session_group *s1, struct session_group *s2)
{ {
return (strcmp(s1->name, s2->name)); 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 * Find if session is still alive. This is true if it is still on the global

16
tmux.h
View File

@ -1741,7 +1741,6 @@ int cmd_find_empty_state(struct cmd_find_state *);
int cmd_find_valid_state(struct cmd_find_state *); int cmd_find_valid_state(struct cmd_find_state *);
void cmd_find_copy_state(struct cmd_find_state *, void cmd_find_copy_state(struct cmd_find_state *,
struct cmd_find_state *); struct cmd_find_state *);
void cmd_find_log_state(const char *, struct cmd_find_state *);
void cmd_find_from_session(struct cmd_find_state *, void cmd_find_from_session(struct cmd_find_state *,
struct session *, int); struct session *, int);
void cmd_find_from_winlink(struct cmd_find_state *, void cmd_find_from_winlink(struct cmd_find_state *,
@ -1810,13 +1809,13 @@ void cmd_wait_for_flush(void);
int client_main(struct event_base *, int, char **, int); int client_main(struct event_base *, int, char **, int);
/* key-bindings.c */ /* key-bindings.c */
RB_PROTOTYPE(key_bindings, key_binding, entry, key_bindings_cmp);
RB_PROTOTYPE(key_tables, key_table, entry, key_table_cmp);
extern struct key_tables key_tables;
int key_table_cmp(struct key_table *, struct key_table *);
int key_bindings_cmp(struct key_binding *, struct key_binding *);
struct key_table *key_bindings_get_table(const char *, int); struct key_table *key_bindings_get_table(const char *, int);
struct key_table *key_bindings_first_table(void);
struct key_table *key_bindings_next_table(struct key_table *);
void key_bindings_unref_table(struct key_table *); void key_bindings_unref_table(struct key_table *);
struct key_binding *key_bindings_get(struct key_table *, key_code);
struct key_binding *key_bindings_first(struct key_table *);
struct key_binding *key_bindings_next(struct key_table *, struct key_binding *);
void key_bindings_add(const char *, key_code, int, struct cmd_list *); void key_bindings_add(const char *, key_code, int, struct cmd_list *);
void key_bindings_remove(const char *, key_code); void key_bindings_remove(const char *, key_code);
void key_bindings_remove_table(const char *); void key_bindings_remove_table(const char *);
@ -1850,7 +1849,6 @@ void server_add_accept(int);
/* server-client.c */ /* server-client.c */
u_int server_client_how_many(void); u_int server_client_how_many(void);
void server_client_set_identify(struct client *, u_int); void server_client_set_identify(struct client *, u_int);
void server_client_clear_identify(struct client *, struct window_pane *);
void server_client_set_key_table(struct client *, const char *); void server_client_set_key_table(struct client *, const char *);
const char *server_client_get_key_table(struct client *); const char *server_client_get_key_table(struct client *);
int server_client_check_nested(struct client *); int server_client_check_nested(struct client *);
@ -2214,7 +2212,6 @@ void mode_tree_expand_current(struct mode_tree_data *);
void mode_tree_set_current(struct mode_tree_data *, uint64_t); void mode_tree_set_current(struct mode_tree_data *, uint64_t);
void mode_tree_each_tagged(struct mode_tree_data *, mode_tree_each_cb, void mode_tree_each_tagged(struct mode_tree_data *, mode_tree_each_cb,
struct client *, key_code, int); struct client *, key_code, int);
void mode_tree_up(struct mode_tree_data *, int);
void mode_tree_down(struct mode_tree_data *, int); void mode_tree_down(struct mode_tree_data *, int);
struct mode_tree_data *mode_tree_start(struct window_pane *, struct args *, struct mode_tree_data *mode_tree_start(struct window_pane *, struct args *,
mode_tree_build_cb, mode_tree_draw_cb, mode_tree_search_cb, mode_tree_build_cb, mode_tree_draw_cb, mode_tree_search_cb,
@ -2284,11 +2281,8 @@ void control_notify_session_window_changed(struct session *);
/* session.c */ /* session.c */
extern struct sessions sessions; extern struct sessions sessions;
extern struct session_groups session_groups;
int session_cmp(struct session *, struct session *); int session_cmp(struct session *, struct session *);
RB_PROTOTYPE(sessions, session, entry, session_cmp); 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 *); int session_alive(struct session *);
struct session *session_find(const char *); struct session *session_find(const char *);
struct session *session_find_by_id_str(const char *); struct session *session_find_by_id_str(const char *);