Commit | Line | Data |
---|---|---|
7efdcf32 S |
1 | #include <stddef.h> |
2 | ||
3 | #define POOL_CLEAR (1<<0) /* zero fill allocations */ | |
4 | #define POOL_QALIGN (1<<1) /* align data to quanta */ | |
5 | #define POOL_INTERN (1<<2) /* Allocate extent structures */ | |
6 | #define POOL_APPEND (1<<3) /* or appended to extent data */ | |
7 | ||
8 | typedef void *alloc_pool_t; | |
9 | ||
10 | alloc_pool_t pool_create(size_t size, size_t quantum, void (*bomb)(char *), int flags); | |
11 | void pool_destroy(alloc_pool_t pool); | |
12 | void *pool_alloc(alloc_pool_t pool, size_t size, char *bomb); | |
13 | void pool_free(alloc_pool_t pool, size_t size, void *addr); | |
14 | ||
15 | #define pool_talloc(pool, type, count, bomb) \ | |
16 | ((type *)pool_alloc(pool, sizeof(type) * count, bomb)) | |
17 | ||
18 | #define pool_tfree(pool, type, count, addr) \ | |
19 | (pool_free(pool, sizeof(type) * count, addr)) | |
20 |