Now that cmdlists are reference counted, there is no need for two-step

deletion via the dead_key_bindings tree. From Keith Amling.
This commit is contained in:
nicm 2014-05-14 06:21:19 +00:00
parent b2e791b574
commit 53cbae544f
3 changed files with 2 additions and 17 deletions

View File

@ -27,7 +27,6 @@
RB_GENERATE(key_bindings, key_binding, entry, key_bindings_cmp); RB_GENERATE(key_bindings, key_binding, entry, key_bindings_cmp);
struct key_bindings key_bindings; struct key_bindings key_bindings;
struct key_bindings dead_key_bindings;
int int
key_bindings_cmp(struct key_binding *bd1, struct key_binding *bd2) key_bindings_cmp(struct key_binding *bd1, struct key_binding *bd2)
@ -78,20 +77,8 @@ key_bindings_remove(int key)
if ((bd = key_bindings_lookup(key)) == NULL) if ((bd = key_bindings_lookup(key)) == NULL)
return; return;
RB_REMOVE(key_bindings, &key_bindings, bd); RB_REMOVE(key_bindings, &key_bindings, bd);
RB_INSERT(key_bindings, &dead_key_bindings, bd); cmd_list_free(bd->cmdlist);
} free(bd);
void
key_bindings_clean(void)
{
struct key_binding *bd;
while (!RB_EMPTY(&dead_key_bindings)) {
bd = RB_ROOT(&dead_key_bindings);
RB_REMOVE(key_bindings, &dead_key_bindings, bd);
cmd_list_free(bd->cmdlist);
free(bd);
}
} }
void void

View File

@ -208,7 +208,6 @@ server_loop(void)
server_window_loop(); server_window_loop();
server_client_loop(); server_client_loop();
key_bindings_clean();
server_clean_dead(); server_clean_dead();
} }
} }

1
tmux.h
View File

@ -1889,7 +1889,6 @@ RB_PROTOTYPE(key_bindings, key_binding, entry, key_bindings_cmp);
struct key_binding *key_bindings_lookup(int); struct key_binding *key_bindings_lookup(int);
void key_bindings_add(int, int, struct cmd_list *); void key_bindings_add(int, int, struct cmd_list *);
void key_bindings_remove(int); void key_bindings_remove(int);
void key_bindings_clean(void);
void key_bindings_init(void); void key_bindings_init(void);
void key_bindings_dispatch(struct key_binding *, struct client *); void key_bindings_dispatch(struct key_binding *, struct client *);