diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2012-02-15 22:01:08 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2012-02-15 22:01:08 +0400 |
commit | bf2371d272bac279db965abeca2c5979155d8cc3 (patch) | |
tree | 4f23ecda9c5d6c886e864051d884b06e4ef067ce /src/mem_pool.h | |
parent | 384d3c358c36b8649b3ec829887dcb99d0d1f2cf (diff) | |
download | rspamd-bf2371d272bac279db965abeca2c5979155d8cc3.tar.gz rspamd-bf2371d272bac279db965abeca2c5979155d8cc3.zip |
Add temporary pages to pool allocator to allow reset of some pool data.
Diffstat (limited to 'src/mem_pool.h')
-rw-r--r-- | src/mem_pool.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/mem_pool.h b/src/mem_pool.h index 475a00629..970376a9a 100644 --- a/src/mem_pool.h +++ b/src/mem_pool.h @@ -73,6 +73,8 @@ struct _pool_destructors { typedef struct memory_pool_s { struct _pool_chain *cur_pool; /**< currently used page */ struct _pool_chain *first_pool; /**< first page */ + struct _pool_chain *cur_pool_tmp; /**< currently used temporary page */ + struct _pool_chain *first_pool_tmp; /**< first temporary page */ struct _pool_chain_shared *shared_pool; /**< shared chain */ struct _pool_destructors *destructors; /**< destructors chain */ GHashTable *variables; /**< private memory pool variables */ @@ -120,6 +122,14 @@ memory_pool_t* memory_pool_new (gsize size); void* memory_pool_alloc (memory_pool_t* pool, gsize size); /** + * Get memory from temporary pool + * @param pool memory pool object + * @param size bytes to allocate + * @return pointer to allocated object + */ +void* memory_pool_alloc_tmp (memory_pool_t* pool, gsize size); + +/** * Get memory and set it to zero * @param pool memory pool object * @param size bytes to allocate @@ -128,6 +138,19 @@ void* memory_pool_alloc (memory_pool_t* pool, gsize size); void* memory_pool_alloc0 (memory_pool_t* pool, gsize size); /** + * Get memory and set it to zero + * @param pool memory pool object + * @param size bytes to allocate + * @return pointer to allocated object + */ +void* memory_pool_alloc0_tmp (memory_pool_t* pool, gsize size); + +/** + * Cleanup temporary data in pool + */ +void memory_pool_cleanup_tmp (memory_pool_t* pool); + +/** * Make a copy of string in pool * @param pool memory pool object * @param src source string |