From 723019f727ce53b392389bdadcc1701ae47e6a14 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sun, 7 Mar 2021 18:15:50 +0100 Subject: Optionally use a pool allocator for rb-tree nodes This commit restructures the rbtree code to optionally use a pool allocator for the nodes. The option is made depenend on the presence of a pre-processor flag. To the configure script is added an option to enable/disable the use of custom allocators. It makes sense to still allow the malloc/free based routes for better ASAN based instrumentation. Signed-off-by: David Oberhollenzer --- include/rbtree.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/rbtree.h b/include/rbtree.h index b1ddcd2..aac175b 100644 --- a/include/rbtree.h +++ b/include/rbtree.h @@ -9,6 +9,7 @@ #include "config.h" #include "sqfs/predef.h" +#include "mempool.h" #include "compat.h" #include @@ -26,6 +27,10 @@ typedef struct 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); -- cgit v1.2.3