diff options
Diffstat (limited to 'src/mempool.h')
-rw-r--r-- | src/mempool.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mempool.h b/src/mempool.h index 7d065f5..bca1e31 100644 --- a/src/mempool.h +++ b/src/mempool.h @@ -2,7 +2,7 @@ #define MEMPOOL_H /* To generate use MEMPOOL_GENERATE(id, type, cap), where functions - * _mempool_allocate() and _mempool_free(type *obj) will be prefixed with id + * _mempool_allocate() and _mempool_free(type *obj) will be prefixed with <id> * and can be used to allocate objects of type <type> with <cap> objects in * each block */ @@ -10,7 +10,7 @@ #define for_each_block(id, b, head) \ for(struct id##_block *b = (head), *next = NULL; \ b && (next = b->next, 1); b = next) -#define get_last_block(b) \ +#define get_last_block(b) \ while((b)->next != NULL) (b) = (b)->next #define MEMPOOL_GENERATE(id, type, cap) \ @@ -31,9 +31,9 @@ static inline void *_##id##_mempool_init_block(struct id##_block *b) \ { \ b->next = NULL; \ - for(size_t i = 0; i < cap; i++) \ + for(size_t i = 0; i < cap; i++) \ b->chunks[i].next = &b->chunks[i+1]; \ - b->chunks[cap-1].next = NULL; \ + b->chunks[cap-1].next = NULL; \ \ return b->chunks; \ } \ |