| 181 | } |
| 182 | |
| 183 | ACL_MEM_POOL *acl_allocator_pool_add(ACL_ALLOCATOR *allocator, |
| 184 | const char *label, size_t obj_size, acl_mem_type type, |
| 185 | void (*after_alloc_fn)(void *obj, void *pool_ctx), |
| 186 | void (*before_free_fn)(void *obj, void *pool_ctx), void *pool_ctx) |
| 187 | { |
| 188 | const char *myname = "acl_allocator_pool_add"; |
| 189 | ACL_MEM_POOL *pool; |
| 190 | |
| 191 | CHECK_TYPE(type); |
| 192 | |
| 193 | pool = allocator->pool_create_fn(); |
| 194 | pool->label = label; |
| 195 | pool->obj_size = obj_size; |
| 196 | #if DEBUG_MEMPOOL |
| 197 | pool->real_obj_size = (obj_size & 7) ? (obj_size | 7) + 1 : obj_size; |
| 198 | #endif |
| 199 | pool->type = type; |
| 200 | pool->after_alloc_fn = after_alloc_fn; |
| 201 | pool->before_free_fn = before_free_fn; |
| 202 | pool->pool_ctx = pool_ctx; |
| 203 | pool->pstack = acl_stack_create(1000); |
| 204 | |
| 205 | allocator->MemPools[type] = pool; |
| 206 | acl_stack_append(allocator->pools, pool); |
| 207 | |
| 208 | return pool; |
| 209 | } |
| 210 | |
| 211 | void acl_allocator_pool_remove(ACL_ALLOCATOR *allocator, ACL_MEM_POOL *pool) |
| 212 | { |
no test coverage detected
searching dependent graphs…