diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2014-05-14 06:21:20 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2014-05-14 06:21:20 +0000 |
commit | 1101cfc744496d5313389429488d8fd7773bfec6 (patch) | |
tree | 8099b90812dd0f550156801cdbc259cdc985bc17 | |
parent | 3464c18d1fdda01444b65f52f810987ed7d85c43 (diff) |
Now that cmdlists are reference counted, there is no need for two-step
deletion via the dead_key_bindings tree. From Keith Amling.
-rw-r--r-- | usr.bin/tmux/key-bindings.c | 19 | ||||
-rw-r--r-- | usr.bin/tmux/server.c | 3 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 3 |
3 files changed, 5 insertions, 20 deletions
diff --git a/usr.bin/tmux/key-bindings.c b/usr.bin/tmux/key-bindings.c index 23260b61873..3c861045717 100644 --- a/usr.bin/tmux/key-bindings.c +++ b/usr.bin/tmux/key-bindings.c @@ -1,4 +1,4 @@ -/* $OpenBSD: key-bindings.c,v 1.40 2014/04/17 07:55:43 nicm Exp $ */ +/* $OpenBSD: key-bindings.c,v 1.41 2014/05/14 06:21:19 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -27,7 +27,6 @@ RB_GENERATE(key_bindings, key_binding, entry, key_bindings_cmp); struct key_bindings key_bindings; -struct key_bindings dead_key_bindings; int 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) return; RB_REMOVE(key_bindings, &key_bindings, bd); - RB_INSERT(key_bindings, &dead_key_bindings, 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); - } + cmd_list_free(bd->cmdlist); + free(bd); } void diff --git a/usr.bin/tmux/server.c b/usr.bin/tmux/server.c index 2a7e1431633..f3706aed213 100644 --- a/usr.bin/tmux/server.c +++ b/usr.bin/tmux/server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server.c,v 1.113 2014/04/24 09:14:43 nicm Exp $ */ +/* $OpenBSD: server.c,v 1.114 2014/05/14 06:21:19 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -208,7 +208,6 @@ server_loop(void) server_window_loop(); server_client_loop(); - key_bindings_clean(); server_clean_dead(); } } diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 0f5495785f9..e897fde7cff 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.463 2014/05/13 08:08:32 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.464 2014/05/14 06:21:19 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -1889,7 +1889,6 @@ RB_PROTOTYPE(key_bindings, key_binding, entry, key_bindings_cmp); struct key_binding *key_bindings_lookup(int); void key_bindings_add(int, int, struct cmd_list *); void key_bindings_remove(int); -void key_bindings_clean(void); void key_bindings_init(void); void key_bindings_dispatch(struct key_binding *, struct client *); |