summaryrefslogtreecommitdiff
path: root/rdxtree.h
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2017-01-26 00:41:07 +0100
committerRichard Braun <rbraun@sceen.net>2017-01-26 00:41:07 +0100
commit900d78f86a2a6684a956f95163898814eb54d9ea (patch)
tree445937ac20493639c10b5d01f0b7d6080d1eb7af /rdxtree.h
parentbd875458fcb4aa5516996ffb128b601a89bd25af (diff)
rdxtree: make key allocation optional
Diffstat (limited to 'rdxtree.h')
-rw-r--r--rdxtree.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/rdxtree.h b/rdxtree.h
index 32b4aa2..be0db3b 100644
--- a/rdxtree.h
+++ b/rdxtree.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2015 Richard Braun.
+ * Copyright (c) 2011-2017 Richard Braun.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -52,6 +52,11 @@ typedef uint64_t rdxtree_key_t;
#endif /* RDXTREE_KEY_32 */
/*
+ * Radix tree initialization flags.
+ */
+#define RDXTREE_KEY_ALLOC 0x1 /* Enable key allocation */
+
+/*
* Radix tree.
*/
struct rdxtree;
@@ -72,9 +77,12 @@ struct rdxtree_iter;
* Initialize a tree.
*/
static inline void
-rdxtree_init(struct rdxtree *tree)
+rdxtree_init(struct rdxtree *tree, unsigned short flags)
{
+ assert((flags & ~RDXTREE_KEY_ALLOC) == 0);
+
tree->height = 0;
+ tree->flags = flags;
tree->root = NULL;
}