|
|
1.1 root 1: /* 1.1.1.2 ! root 2: * Copyright (c) 2011-2015 Richard Braun. ! 3: * All rights reserved. 1.1 root 4: * 1.1.1.2 ! root 5: * Redistribution and use in source and binary forms, with or without ! 6: * modification, are permitted provided that the following conditions ! 7: * are met: ! 8: * 1. Redistributions of source code must retain the above copyright ! 9: * notice, this list of conditions and the following disclaimer. ! 10: * 2. Redistributions in binary form must reproduce the above copyright ! 11: * notice, this list of conditions and the following disclaimer in the ! 12: * documentation and/or other materials provided with the distribution. ! 13: * ! 14: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR ! 15: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ! 16: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ! 17: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, ! 18: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT ! 19: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ! 20: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ! 21: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ! 22: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ! 23: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 1.1 root 24: * 25: * 26: * Upstream site with license notes : 27: * http://git.sceen.net/rbraun/librbraun.git/ 28: */ 29: 30: #ifndef _RDXTREE_I_H 31: #define _RDXTREE_I_H 32: 33: /* 34: * Radix tree. 35: */ 36: struct rdxtree { 37: unsigned int height; 38: void *root; 39: }; 40: 41: /* 42: * Radix tree iterator. 43: * 44: * The node member refers to the node containing the current pointer, if any. 45: * The key member refers to the current pointer, and is valid if and only if 46: * rdxtree_walk() has been called at least once on the iterator. 47: */ 48: struct rdxtree_iter { 49: void *node; 50: rdxtree_key_t key; 51: }; 52: 53: /* 54: * Initialize an iterator. 55: */ 56: static inline void 57: rdxtree_iter_init(struct rdxtree_iter *iter) 58: { 59: iter->node = NULL; 60: iter->key = (rdxtree_key_t)-1; 61: } 62: 63: int rdxtree_insert_common(struct rdxtree *tree, rdxtree_key_t key, 64: void *ptr, void ***slotp); 65: 66: int rdxtree_insert_alloc_common(struct rdxtree *tree, void *ptr, 67: rdxtree_key_t *keyp, void ***slotp); 68: 69: void * rdxtree_lookup_common(const struct rdxtree *tree, rdxtree_key_t key, 70: int get_slot); 71: 72: void * rdxtree_walk(struct rdxtree *tree, struct rdxtree_iter *iter); 73: 74: #endif /* _RDXTREE_I_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.