diff options
author | kartofen <mladenovnasko0@gmail.com> | 2024-09-08 20:02:06 +0300 |
---|---|---|
committer | kartofen <mladenovnasko0@gmail.com> | 2024-09-08 20:02:06 +0300 |
commit | f60047d4b013eb7f75ad4f5c63eda63153a4bf8e (patch) | |
tree | 2a3e9fd5fc1eb07b7e06797f74f5e7a31c313159 /src/mempool.h | |
parent | 4308cd4abe5a75fb8410df929eac687cbd04032b (diff) |
value is now opaque
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; \ } \ |