version 1.1.1.2, 2013/10/14 07:51:14
|
version 1.1.1.3, 2021/03/17 00:32:36
|
Line 45 struct align_test {
|
Line 45 struct align_test {
|
#define PTR_ADD(b,o) ( (void*) ((char*)(b) + (o)) ) |
#define PTR_ADD(b,o) ( (void*) ((char*)(b) + (o)) ) |
|
|
alloc_pool_t |
alloc_pool_t |
pool_create(size_t size, size_t quantum, void (*bomb)(const char *), int flags) | pool_create(size_t size, size_t quantum, void (*bomb)(const char*, const char*, int), int flags) |
{ |
{ |
struct alloc_pool *pool; |
struct alloc_pool *pool; |
|
|
if (!(pool = new0(struct alloc_pool))) |
|
return NULL; |
|
|
|
if ((MINALIGN & (MINALIGN - 1)) != 0) { |
if ((MINALIGN & (MINALIGN - 1)) != 0) { |
if (bomb) |
if (bomb) |
(*bomb)("Compiler error: MINALIGN is not a power of 2\n"); | (*bomb)("Compiler error: MINALIGN is not a power of 2", __FILE__, __LINE__); |
return NULL; |
return NULL; |
} |
} |
|
|
|
if (!(pool = new0(struct alloc_pool))) |
|
return NULL; |
|
|
if (!size) |
if (!size) |
size = POOL_DEF_EXTENT; |
size = POOL_DEF_EXTENT; |
if (!quantum) |
if (!quantum) |
Line 169 pool_alloc(alloc_pool_t p, size_t len, const char *bom
|
Line 169 pool_alloc(alloc_pool_t p, size_t len, const char *bom
|
|
|
bomb_out: |
bomb_out: |
if (pool->bomb) |
if (pool->bomb) |
(*pool->bomb)(bomb_msg); | (*pool->bomb)(bomb_msg, __FILE__, __LINE__); |
return NULL; |
return NULL; |
} |
} |
|
|