summaryrefslogtreecommitdiffstats
path: root/key-bindings.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2012-01-21 11:12:13 +0000
committerNicholas Marriott <nicm@openbsd.org>2012-01-21 11:12:13 +0000
commit8ed9124f3fd307a26b2b5032b02b05fe7ede023b (patch)
tree2d9e1897c93b8c529cb57aa064df061735bf2c0b /key-bindings.c
parent535286c05aee55c0127cdabada8e54582905ef8e (diff)
Use RB trees not SPLAY.
Diffstat (limited to 'key-bindings.c')
-rw-r--r--key-bindings.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/key-bindings.c b/key-bindings.c
index fe8a7576..fb1590a5 100644
--- a/key-bindings.c
+++ b/key-bindings.c
@@ -24,7 +24,7 @@
#include "tmux.h"
-SPLAY_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 dead_key_bindings;
@@ -52,7 +52,7 @@ key_bindings_lookup(int key)
struct key_binding bd;
bd.key = key;
- return (SPLAY_FIND(key_bindings, &key_bindings, &bd));
+ return (RB_FIND(key_bindings, &key_bindings, &bd));
}
void
@@ -64,7 +64,7 @@ key_bindings_add(int key, int can_repeat, struct cmd_list *cmdlist)
bd = xmalloc(sizeof *bd);
bd->key = key;
- SPLAY_INSERT(key_bindings, &key_bindings, bd);
+ RB_INSERT(key_bindings, &key_bindings, bd);
bd->can_repeat = can_repeat;
bd->cmdlist = cmdlist;
@@ -77,8 +77,8 @@ key_bindings_remove(int key)
if ((bd = key_bindings_lookup(key)) == NULL)
return;
- SPLAY_REMOVE(key_bindings, &key_bindings, bd);
- SPLAY_INSERT(key_bindings, &dead_key_bindings, bd);
+ RB_REMOVE(key_bindings, &key_bindings, bd);
+ RB_INSERT(key_bindings, &dead_key_bindings, bd);
}
void
@@ -86,9 +86,9 @@ key_bindings_clean(void)
{
struct key_binding *bd;
- while (!SPLAY_EMPTY(&dead_key_bindings)) {
- bd = SPLAY_ROOT(&dead_key_bindings);
- SPLAY_REMOVE(key_bindings, &dead_key_bindings, 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);
xfree(bd);
}
@@ -179,7 +179,7 @@ key_bindings_init(void)
struct cmd *cmd;
struct cmd_list *cmdlist;
- SPLAY_INIT(&key_bindings);
+ RB_INIT(&key_bindings);
for (i = 0; i < nitems(table); i++) {
cmdlist = xmalloc(sizeof *cmdlist);