summaryrefslogtreecommitdiff
path: root/rbtree.h
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-10-30 10:58:28 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-10-30 10:58:28 -0700
commite8873121aadbbb465c0c48da3c56b47a6a5f1d68 (patch)
tree9333fb01193d78f0f02050359f8acfeb7cfc672a /rbtree.h
parent9656a581cdb6f505c9adc6b5158b395c21b5c43a (diff)
downloadnasm-e8873121aadbbb465c0c48da3c56b47a6a5f1d68.tar.gz
nasm-e8873121aadbbb465c0c48da3c56b47a6a5f1d68.tar.bz2
nasm-e8873121aadbbb465c0c48da3c56b47a6a5f1d68.zip
rbtree: drop the data pointer; instead rely on being embedded
Drop the data pointer, and instead assume the struct rbtree will be embedded in a bigger data structure (to be extracted via container_of()). Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'rbtree.h')
-rw-r--r--rbtree.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/rbtree.h b/rbtree.h
index 3b45428..d24daf3 100644
--- a/rbtree.h
+++ b/rbtree.h
@@ -4,15 +4,16 @@
#include "compiler.h"
#include <inttypes.h>
+/* This structure should be embedded in a larger data structure;
+ the final output from rb_search() can then be converted back
+ to the larger data structure via container_of(). */
struct rbtree {
uint64_t key;
- void *data;
struct rbtree *left, *right;
bool red;
};
-struct rbtree *rb_insert(struct rbtree *, uint64_t, void *);
+struct rbtree *rb_insert(struct rbtree *, struct rbtree *);
const struct rbtree *rb_search(const struct rbtree *, uint64_t);
-void rb_free(struct rbtree *);
#endif /* NASM_RBTREE_H */