diff options
-rw-r--r-- | usr.bin/tmux/cmd-bind-key.c | 6 | ||||
-rw-r--r-- | usr.bin/tmux/cmd-list-keys.c | 10 | ||||
-rw-r--r-- | usr.bin/tmux/cmd-unbind-key.c | 10 | ||||
-rw-r--r-- | usr.bin/tmux/key-bindings.c | 20 | ||||
-rw-r--r-- | usr.bin/tmux/mode-key.c | 10 | ||||
-rw-r--r-- | usr.bin/tmux/options.c | 24 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 20 |
7 files changed, 50 insertions, 50 deletions
diff --git a/usr.bin/tmux/cmd-bind-key.c b/usr.bin/tmux/cmd-bind-key.c index d34cc988fd8..a01a95025b2 100644 --- a/usr.bin/tmux/cmd-bind-key.c +++ b/usr.bin/tmux/cmd-bind-key.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-bind-key.c,v 1.11 2011/01/15 20:14:41 nicm Exp $ */ +/* $OpenBSD: cmd-bind-key.c,v 1.12 2012/01/21 11:12:13 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -107,7 +107,7 @@ cmd_bind_key_table(struct cmd *self, struct cmd_ctx *ctx, int key) mtmp.key = key; mtmp.mode = !!args_has(args, 'c'); - if ((mbind = SPLAY_FIND(mode_key_tree, mtab->tree, &mtmp)) != NULL) { + if ((mbind = RB_FIND(mode_key_tree, mtab->tree, &mtmp)) != NULL) { mbind->cmd = cmd; return (0); } @@ -115,6 +115,6 @@ cmd_bind_key_table(struct cmd *self, struct cmd_ctx *ctx, int key) mbind->key = mtmp.key; mbind->mode = mtmp.mode; mbind->cmd = cmd; - SPLAY_INSERT(mode_key_tree, mtab->tree, mbind); + RB_INSERT(mode_key_tree, mtab->tree, mbind); return (0); } diff --git a/usr.bin/tmux/cmd-list-keys.c b/usr.bin/tmux/cmd-list-keys.c index f502033b2f2..1731ab3c68a 100644 --- a/usr.bin/tmux/cmd-list-keys.c +++ b/usr.bin/tmux/cmd-list-keys.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-list-keys.c,v 1.16 2011/12/27 13:41:50 nicm Exp $ */ +/* $OpenBSD: cmd-list-keys.c,v 1.17 2012/01/21 11:12:13 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -55,7 +55,7 @@ cmd_list_keys_exec(struct cmd *self, struct cmd_ctx *ctx) width = 0; - SPLAY_FOREACH(bd, key_bindings, &key_bindings) { + RB_FOREACH(bd, key_bindings, &key_bindings) { key = key_string_lookup_key(bd->key & ~KEYC_PREFIX); if (key == NULL) continue; @@ -72,7 +72,7 @@ cmd_list_keys_exec(struct cmd *self, struct cmd_ctx *ctx) width = keywidth; } - SPLAY_FOREACH(bd, key_bindings, &key_bindings) { + RB_FOREACH(bd, key_bindings, &key_bindings) { key = key_string_lookup_key(bd->key & ~KEYC_PREFIX); if (key == NULL) continue; @@ -116,7 +116,7 @@ cmd_list_keys_table(struct cmd *self, struct cmd_ctx *ctx) width = 0; any_mode = 0; - SPLAY_FOREACH(mbind, mode_key_tree, mtab->tree) { + RB_FOREACH(mbind, mode_key_tree, mtab->tree) { key = key_string_lookup_key(mbind->key); if (key == NULL) continue; @@ -129,7 +129,7 @@ cmd_list_keys_table(struct cmd *self, struct cmd_ctx *ctx) width = keywidth; } - SPLAY_FOREACH(mbind, mode_key_tree, mtab->tree) { + RB_FOREACH(mbind, mode_key_tree, mtab->tree) { key = key_string_lookup_key(mbind->key); if (key == NULL) continue; diff --git a/usr.bin/tmux/cmd-unbind-key.c b/usr.bin/tmux/cmd-unbind-key.c index 82b1034c035..0b351a19bf5 100644 --- a/usr.bin/tmux/cmd-unbind-key.c +++ b/usr.bin/tmux/cmd-unbind-key.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-unbind-key.c,v 1.11 2011/08/16 09:37:48 nicm Exp $ */ +/* $OpenBSD: cmd-unbind-key.c,v 1.12 2012/01/21 11:12:13 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -57,8 +57,8 @@ cmd_unbind_key_exec(struct cmd *self, unused struct cmd_ctx *ctx) int key; if (args_has(args, 'a')) { - while (!SPLAY_EMPTY(&key_bindings)) { - bd = SPLAY_ROOT(&key_bindings); + while (!RB_EMPTY(&key_bindings)) { + bd = RB_ROOT(&key_bindings); key_bindings_remove(bd->key); } return (0); @@ -95,8 +95,8 @@ cmd_unbind_key_table(struct cmd *self, struct cmd_ctx *ctx, int key) mtmp.key = key; mtmp.mode = !!args_has(args, 'c'); - if ((mbind = SPLAY_FIND(mode_key_tree, mtab->tree, &mtmp)) != NULL) { - SPLAY_REMOVE(mode_key_tree, mtab->tree, mbind); + if ((mbind = RB_FIND(mode_key_tree, mtab->tree, &mtmp)) != NULL) { + RB_REMOVE(mode_key_tree, mtab->tree, mbind); xfree(mbind); } return (0); diff --git a/usr.bin/tmux/key-bindings.c b/usr.bin/tmux/key-bindings.c index 1c51fccef8c..fb9268427c1 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.28 2011/07/03 18:18:15 nicm Exp $ */ +/* $OpenBSD: key-bindings.c,v 1.29 2012/01/21 11:12:13 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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); diff --git a/usr.bin/tmux/mode-key.c b/usr.bin/tmux/mode-key.c index 4e52a5cb9e2..e37970c77ff 100644 --- a/usr.bin/tmux/mode-key.c +++ b/usr.bin/tmux/mode-key.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mode-key.c,v 1.43 2012/01/20 19:10:29 nicm Exp $ */ +/* $OpenBSD: mode-key.c,v 1.44 2012/01/21 11:12:13 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -412,7 +412,7 @@ const struct mode_key_table mode_key_tables[] = { { NULL, NULL, NULL, NULL } }; -SPLAY_GENERATE(mode_key_tree, mode_key_binding, entry, mode_key_cmp); +RB_GENERATE(mode_key_tree, mode_key_binding, entry, mode_key_cmp); int mode_key_cmp(struct mode_key_binding *mbind1, struct mode_key_binding *mbind2) @@ -462,13 +462,13 @@ mode_key_init_trees(void) struct mode_key_binding *mbind; for (mtab = mode_key_tables; mtab->name != NULL; mtab++) { - SPLAY_INIT(mtab->tree); + RB_INIT(mtab->tree); for (ment = mtab->table; ment->mode != -1; ment++) { mbind = xmalloc(sizeof *mbind); mbind->key = ment->key; mbind->mode = ment->mode; mbind->cmd = ment->cmd; - SPLAY_INSERT(mode_key_tree, mtab->tree, mbind); + RB_INSERT(mode_key_tree, mtab->tree, mbind); } } } @@ -487,7 +487,7 @@ mode_key_lookup(struct mode_key_data *mdata, int key) mtmp.key = key; mtmp.mode = mdata->mode; - if ((mbind = SPLAY_FIND(mode_key_tree, mdata->tree, &mtmp)) == NULL) { + if ((mbind = RB_FIND(mode_key_tree, mdata->tree, &mtmp)) == NULL) { if (mdata->mode != 0) return (MODEKEY_NONE); return (MODEKEY_OTHER); diff --git a/usr.bin/tmux/options.c b/usr.bin/tmux/options.c index 0b6b66fc0dd..d3458ddc2f0 100644 --- a/usr.bin/tmux/options.c +++ b/usr.bin/tmux/options.c @@ -1,4 +1,4 @@ -/* $OpenBSD: options.c,v 1.6 2012/01/21 08:40:09 nicm Exp $ */ +/* $OpenBSD: options.c,v 1.7 2012/01/21 11:12:13 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -28,7 +28,7 @@ * a splay tree. */ -SPLAY_GENERATE(options_tree, options_entry, entry, options_cmp); +RB_GENERATE(options_tree, options_entry, entry, options_cmp); int options_cmp(struct options_entry *o1, struct options_entry *o2) @@ -39,7 +39,7 @@ options_cmp(struct options_entry *o1, struct options_entry *o2) void options_init(struct options *oo, struct options *parent) { - SPLAY_INIT(&oo->tree); + RB_INIT(&oo->tree); oo->parent = parent; } @@ -48,9 +48,9 @@ options_free(struct options *oo) { struct options_entry *o; - while (!SPLAY_EMPTY(&oo->tree)) { - o = SPLAY_ROOT(&oo->tree); - SPLAY_REMOVE(options_tree, &oo->tree, o); + while (!RB_EMPTY(&oo->tree)) { + o = RB_ROOT(&oo->tree); + RB_REMOVE(options_tree, &oo->tree, o); xfree(o->name); if (o->type == OPTIONS_STRING) xfree(o->str); @@ -64,7 +64,7 @@ options_find1(struct options *oo, const char *name) struct options_entry p; p.name = (char *) name; - return (SPLAY_FIND(options_tree, &oo->tree, &p)); + return (RB_FIND(options_tree, &oo->tree, &p)); } struct options_entry * @@ -73,12 +73,12 @@ options_find(struct options *oo, const char *name) struct options_entry *o, p; p.name = (char *) name; - o = SPLAY_FIND(options_tree, &oo->tree, &p); + o = RB_FIND(options_tree, &oo->tree, &p); while (o == NULL) { oo = oo->parent; if (oo == NULL) break; - o = SPLAY_FIND(options_tree, &oo->tree, &p); + o = RB_FIND(options_tree, &oo->tree, &p); } return (o); } @@ -91,7 +91,7 @@ options_remove(struct options *oo, const char *name) if ((o = options_find1(oo, name)) == NULL) return; - SPLAY_REMOVE(options_tree, &oo->tree, o); + RB_REMOVE(options_tree, &oo->tree, o); xfree(o->name); if (o->type == OPTIONS_STRING) xfree(o->str); @@ -107,7 +107,7 @@ options_set_string(struct options *oo, const char *name, const char *fmt, ...) if ((o = options_find1(oo, name)) == NULL) { o = xmalloc(sizeof *o); o->name = xstrdup(name); - SPLAY_INSERT(options_tree, &oo->tree, o); + RB_INSERT(options_tree, &oo->tree, o); } else if (o->type == OPTIONS_STRING) xfree(o->str); @@ -138,7 +138,7 @@ options_set_number(struct options *oo, const char *name, long long value) if ((o = options_find1(oo, name)) == NULL) { o = xmalloc(sizeof *o); o->name = xstrdup(name); - SPLAY_INSERT(options_tree, &oo->tree, o); + RB_INSERT(options_tree, &oo->tree, o); } else if (o->type == OPTIONS_STRING) xfree(o->str); diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index d63165001c5..a7317a0778f 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.305 2012/01/21 08:40:09 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.306 2012/01/21 11:12:13 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -545,9 +545,9 @@ struct mode_key_binding { int mode; enum mode_key_cmd cmd; - SPLAY_ENTRY(mode_key_binding) entry; + RB_ENTRY(mode_key_binding) entry; }; -SPLAY_HEAD(mode_key_tree, mode_key_binding); +RB_HEAD(mode_key_tree, mode_key_binding); /* Command to string mapping. */ struct mode_key_cmdstr { @@ -674,11 +674,11 @@ struct options_entry { char *str; long long num; - SPLAY_ENTRY(options_entry) entry; + RB_ENTRY(options_entry) entry; }; struct options { - SPLAY_HEAD(options_tree, options_entry) tree; + RB_HEAD(options_tree, options_entry) tree; struct options *parent; }; @@ -1276,9 +1276,9 @@ struct key_binding { struct cmd_list *cmdlist; int can_repeat; - SPLAY_ENTRY(key_binding) entry; + RB_ENTRY(key_binding) entry; }; -SPLAY_HEAD(key_bindings, key_binding); +RB_HEAD(key_bindings, key_binding); /* * Option table entries. The option table is the user-visible part of the @@ -1383,7 +1383,7 @@ extern struct mode_key_tree mode_key_tree_emacs_edit; extern struct mode_key_tree mode_key_tree_emacs_choice; extern struct mode_key_tree mode_key_tree_emacs_copy; int mode_key_cmp(struct mode_key_binding *, struct mode_key_binding *); -SPLAY_PROTOTYPE(mode_key_tree, mode_key_binding, entry, mode_key_cmp); +RB_PROTOTYPE(mode_key_tree, mode_key_binding, entry, mode_key_cmp); const char *mode_key_tostring(const struct mode_key_cmdstr *, enum mode_key_cmd); enum mode_key_cmd mode_key_fromstring(const struct mode_key_cmdstr *, @@ -1395,7 +1395,7 @@ enum mode_key_cmd mode_key_lookup(struct mode_key_data *, int); /* options.c */ int options_cmp(struct options_entry *, struct options_entry *); -SPLAY_PROTOTYPE(options_tree, options_entry, entry, options_cmp); +RB_PROTOTYPE(options_tree, options_entry, entry, options_cmp); void options_init(struct options *, struct options *); void options_free(struct options *); struct options_entry *options_find1(struct options *, const char *); @@ -1657,7 +1657,7 @@ int client_main(int, char **, int); /* key-bindings.c */ extern struct key_bindings key_bindings; int key_bindings_cmp(struct key_binding *, struct key_binding *); -SPLAY_PROTOTYPE(key_bindings, key_binding, entry, key_bindings_cmp); +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); |