diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2021-03-05 18:58:12 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2021-03-06 22:08:36 +0100 |
commit | 919d1e85f2cc17059f72db48c3bc38e0b524f6c0 (patch) | |
tree | cac9b227ee4edac72b7c850370c23cbcf68d3d93 /include/rbtree.h | |
parent | 02db0ae8ff83a42913b1b4224ccd8377f5fc5323 (diff) |
Add a context pointer to the rbtree key comparison
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include/rbtree.h')
-rw-r--r-- | include/rbtree.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/include/rbtree.h b/include/rbtree.h index bbba711..b1ddcd2 100644 --- a/include/rbtree.h +++ b/include/rbtree.h @@ -26,12 +26,15 @@ typedef struct rbtree_node_t { typedef struct rbtree_t { rbtree_node_t *root; - int (*key_compare)(const void *lhs, const void *hrs); + 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) @@ -45,7 +48,8 @@ static SQFS_INLINE void *rbtree_node_value(rbtree_node_t *n) } SQFS_INTERNAL int rbtree_init(rbtree_t *tree, size_t keysize, size_t valuesize, - int(*key_compare)(const void *, const void *)); + int(*key_compare)(const void *, const void *, + const void *)); SQFS_INTERNAL void rbtree_cleanup(rbtree_t *tree); |