diff options
| author | 2012-01-21 11:12:13 +0000 | |
|---|---|---|
| committer | 2012-01-21 11:12:13 +0000 | |
| commit | 574ef2a1d1ea328fc0d709b820108f9f1ae58aed (patch) | |
| tree | 23a3dbcd3eb77ea2c1c57c0d7644e151fd9cea1f /usr.bin/tmux/options.c | |
| parent | Drop the ability to have a list of keys in the prefix in favour of two (diff) | |
| download | wireguard-openbsd-574ef2a1d1ea328fc0d709b820108f9f1ae58aed.tar.xz wireguard-openbsd-574ef2a1d1ea328fc0d709b820108f9f1ae58aed.zip | |
Use RB trees not SPLAY.
Diffstat (limited to 'usr.bin/tmux/options.c')
| -rw-r--r-- | usr.bin/tmux/options.c | 24 |
1 files changed, 12 insertions, 12 deletions
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); |
