diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2022-06-26 16:45:52 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2022-07-08 19:17:35 +0200 |
commit | 2087cc237cd0fe1ed29ebf891648bacb46f4833b (patch) | |
tree | ede4ba232bea36d8fc670ce360514927a2400bc7 /include/rbtree.h | |
parent | aed35c78c6a51a4b4c37ebda5643d2246842fb74 (diff) |
Cleanup: move libutil headers to sub directory
Move all the libutil stuff from the toplevel include/ to a util/
sub directory and fix up the includes that make use of them.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include/rbtree.h')
-rw-r--r-- | include/rbtree.h | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/include/rbtree.h b/include/rbtree.h deleted file mode 100644 index aac175b..0000000 --- a/include/rbtree.h +++ /dev/null @@ -1,74 +0,0 @@ -/* SPDX-License-Identifier: LGPL-3.0-or-later */ -/* - * rbtree.h - * - * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at> - */ -#ifndef SQFS_RBTREE_H -#define SQFS_RBTREE_H - -#include "config.h" -#include "sqfs/predef.h" -#include "mempool.h" -#include "compat.h" - -#include <stddef.h> - -typedef struct rbtree_node_t { - struct rbtree_node_t *left; - struct rbtree_node_t *right; - sqfs_u32 value_offset; - sqfs_u32 is_red : 1; - sqfs_u32 pad0 : 31; - - sqfs_u8 data[]; -} rbtree_node_t; - -typedef struct rbtree_t { - rbtree_node_t *root; - -#ifndef NO_CUSTOM_ALLOC - mem_pool_t *pool; -#endif - - int (*key_compare)(const void *ctx, - const void *lhs, const void *hrs); - - size_t key_size; - size_t key_size_padded; - - size_t value_size; - - void *key_context; -} rbtree_t; - -static SQFS_INLINE void *rbtree_node_key(rbtree_node_t *n) -{ - return n->data; -} - -static SQFS_INLINE void *rbtree_node_value(rbtree_node_t *n) -{ - return n->data + n->value_offset; -} - -SQFS_INTERNAL int rbtree_init(rbtree_t *tree, size_t keysize, size_t valuesize, - int(*key_compare)(const void *, const void *, - const void *)); - -SQFS_INTERNAL void rbtree_cleanup(rbtree_t *tree); - -SQFS_INTERNAL int rbtree_copy(const rbtree_t *tree, rbtree_t *out); - -SQFS_INTERNAL int rbtree_insert(rbtree_t *tree, const void *key, - const void *value); - -SQFS_INTERNAL rbtree_node_t *rbtree_lookup(const rbtree_t *tree, - const void *key); - -#ifdef __cplusplus -} -#endif - -#endif /* TOOLS_RBTREE_H */ - |