aboutsummaryrefslogtreecommitdiff
path: root/key-bindings.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2012-01-21 19:38:26 +0000
committerTiago Cunha <tcunha@gmx.com>2012-01-21 19:38:26 +0000
commita3c1b730c93a648579f68c353573f4319e1219a7 (patch)
tree0df01ddb40ee315383edf072f74c35c41990246e /key-bindings.c
parenta7b0b30bdd73f3a8d513fc69daf593174ee03145 (diff)
downloadrtmux-a3c1b730c93a648579f68c353573f4319e1219a7.tar.gz
rtmux-a3c1b730c93a648579f68c353573f4319e1219a7.tar.bz2
rtmux-a3c1b730c93a648579f68c353573f4319e1219a7.zip
Sync OpenBSD patchset 1008:
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 d71fd521..76439f7d 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);