|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 2013-2015 Richard Braun. ! 3: * ! 4: * This program is free software: you can redistribute it and/or modify ! 5: * it under the terms of the GNU General Public License as published by ! 6: * the Free Software Foundation, either version 3 of the License, or ! 7: * (at your option) any later version. ! 8: * ! 9: * This program is distributed in the hope that it will be useful, ! 10: * but WITHOUT ANY WARRANTY; without even the implied warranty of ! 11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! 12: * GNU General Public License for more details. ! 13: * ! 14: * You should have received a copy of the GNU General Public License ! 15: * along with this program. If not, see <http://www.gnu.org/licenses/>. ! 16: * ! 17: * ! 18: * Upstream site with license notes : ! 19: * http://git.sceen.net/rbraun/librbraun.git/ ! 20: */ ! 21: ! 22: #ifndef _RDXTREE_I_H ! 23: #define _RDXTREE_I_H ! 24: ! 25: /* ! 26: * Radix tree. ! 27: */ ! 28: struct rdxtree { ! 29: unsigned int height; ! 30: void *root; ! 31: }; ! 32: ! 33: /* ! 34: * Radix tree iterator. ! 35: * ! 36: * The node member refers to the node containing the current pointer, if any. ! 37: * The key member refers to the current pointer, and is valid if and only if ! 38: * rdxtree_walk() has been called at least once on the iterator. ! 39: */ ! 40: struct rdxtree_iter { ! 41: void *node; ! 42: rdxtree_key_t key; ! 43: }; ! 44: ! 45: /* ! 46: * Initialize an iterator. ! 47: */ ! 48: static inline void ! 49: rdxtree_iter_init(struct rdxtree_iter *iter) ! 50: { ! 51: iter->node = NULL; ! 52: iter->key = (rdxtree_key_t)-1; ! 53: } ! 54: ! 55: int rdxtree_insert_common(struct rdxtree *tree, rdxtree_key_t key, ! 56: void *ptr, void ***slotp); ! 57: ! 58: int rdxtree_insert_alloc_common(struct rdxtree *tree, void *ptr, ! 59: rdxtree_key_t *keyp, void ***slotp); ! 60: ! 61: void * rdxtree_lookup_common(const struct rdxtree *tree, rdxtree_key_t key, ! 62: int get_slot); ! 63: ! 64: void * rdxtree_walk(struct rdxtree *tree, struct rdxtree_iter *iter); ! 65: ! 66: #endif /* _RDXTREE_I_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.