Lines Matching refs:apool
83 struct allocfree_pool *apool;
87 apool = (struct allocfree_pool *)pool;
88 apool->clean_frees = TRUE;
92 static void pool_allocfree_destroy(struct allocfree_pool *apool)
94 pool_allocfree_clear(&apool->pool);
95 if (apool->clean_frees)
96 safe_memset(apool, 0, SIZEOF_ALLOCFREE_POOL);
98 free(apool->name);
100 free(apool);
106 struct allocfree_pool *apool =
108 return apool->name;
116 struct allocfree_pool *apool =
118 i_assert(apool->refcount > 0);
120 apool->refcount++;
126 struct allocfree_pool *apool =
128 i_assert(apool->refcount > 0);
134 if (--apool->refcount > 0)
137 pool_allocfree_destroy(apool);
140 static void *pool_block_attach(struct allocfree_pool *apool, struct pool_block *block)
143 DLLIST_PREPEND(&apool->blocks, block);
145 apool->total_alloc_used += block->size;
146 apool->total_alloc_count++;
151 pool_block_detach(struct allocfree_pool *apool, unsigned char *mem)
160 i_assert(apool->total_alloc_used >= block->size);
161 i_assert(apool->total_alloc_count > 0);
162 DLLIST_REMOVE(&apool->blocks, block);
163 apool->total_alloc_used -= block->size;
164 apool->total_alloc_count--;
171 struct allocfree_pool *apool =
182 return pool_block_attach(apool, block);
187 struct allocfree_pool *apool =
191 struct pool_block *block = pool_block_detach(apool, mem);
192 if (apool->clean_frees)
200 struct allocfree_pool *apool =
210 struct pool_block *block = pool_block_detach(apool, mem);
221 return pool_block_attach(apool, block);
226 struct allocfree_pool *apool =
230 for (block = apool->blocks; block != NULL; block = next) {
234 i_assert(apool->total_alloc_used == 0 && apool->total_alloc_count == 0);
244 struct allocfree_pool *apool =
246 return apool->total_alloc_used;
251 struct allocfree_pool *apool =
253 return apool->total_alloc_used +
254 SIZEOF_POOLBLOCK*apool->total_alloc_count + sizeof(*apool);