X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Fhashtable.h;h=486fe30bb83e5a00b01183c7866a78c2b6794778;hb=ff36b07f44efa12a78809ee05bd6d0c25fc60495;hp=65931b6764895789c099ab4a114770e6549ebc0f;hpb=52f2814593b57fea3aec5baccf7b332840e1a97d;p=libucw.git diff --git a/lib/hashtable.h b/lib/hashtable.h index 65931b67..486fe30b 100644 --- a/lib/hashtable.h +++ b/lib/hashtable.h @@ -151,6 +151,9 @@ struct P(table) { uns hash_size; uns hash_count, hash_max, hash_min, hash_hard_max; P(bucket) **ht; +#ifdef HASH_AUTO_POOL + struct mempool *pool; +#endif }; #ifdef HASH_TABLE_DYNAMIC @@ -305,11 +308,11 @@ static inline void P(cleanup_alloc) (TAU) { } #elif defined(HASH_AUTO_POOL) /* Use our own pools */ #include "lib/mempool.h" -static struct mempool *P(pool); -static inline void * P(alloc) (TAUC unsigned int size) { return mp_alloc_fast(P(pool), size); } +static inline void * P(alloc) (TAUC unsigned int size) { return mp_alloc_fast(T.pool, size); } static inline void P(free) (TAUC void *x UNUSED) { } -static inline void P(init_alloc) (TAU) { P(pool) = mp_new(HASH_AUTO_POOL); } -static inline void P(cleanup_alloc) (TAU) { mp_delete(P(pool)); } +static inline void P(init_alloc) (TAU) { T.pool = mp_new(HASH_AUTO_POOL); } +static inline void P(cleanup_alloc) (TAU) { mp_delete(T.pool); } +#define HASH_USE_POOL #else /* The default allocation method */