mempool-allocfree.h revision 66251e6ab31e5cc153fe5cae608e416dacafe9cd
9de5eb9e1ac3a07c4197a60fdefd412d6cc78eb2Timo Sirainen/* #define POOL_CHECK_LEAKS */
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen/* Memory allocated and reallocated (the new data in it) in pools is always
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen zeroed, it will cost only a few CPU cycles and may well save some debug
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo SirainenPool pool_create(const char *name, unsigned int size);
db3b95d5a33ddce552d41136ae68d7331f8bf5feTimo Sirainen ((type *) p_malloc(pool, (unsigned) sizeof(type) * (count)))
db3b95d5a33ddce552d41136ae68d7331f8bf5feTimo Sirainen/* p_free_clean() should be used when pool is being destroyed, so freeing
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen memory isn't needed for anything else than detecting memory leaks. */
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen# define p_free_clean(pool, mem) p_free(pool, mem)
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen/* reallocate the `mem' to be exactly `size' */
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenvoid *p_realloc(Pool pool, void *mem, unsigned int size);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen/* reallocate the `mem' to be at least `size' if it wasn't previously */
152db3f90f298b7fb2dbbd4276f0fc30a9bc30f6Timo Sirainenvoid *p_realloc_min(Pool pool, void *mem, unsigned int size);
0dc72981f5286d60ca9233f6ac7c444d393d24fbTimo Sirainen/* Clear the pool. Memory allocated from pool before this call must not be
009217abb57a24a4076092e8e4e165545747839eStephan Bosch used after. */