aboutsummaryrefslogtreecommitdiff
path: root/mempool
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2023-02-04 18:17:39 -0800
committer3gg <3gg@shellblade.net>2023-02-04 18:17:39 -0800
commit75abeca4a9d606bee89a41475f2f451187fec127 (patch)
tree348c29304d2500f87ebce81b5ce843793d53ee68 /mempool
parent90183beeb914590a2ea4eff0242b813562d2d641 (diff)
More compliance with C11.
Diffstat (limited to 'mempool')
-rw-r--r--mempool/include/mempool.h22
1 files changed, 11 insertions, 11 deletions
diff --git a/mempool/include/mempool.h b/mempool/include/mempool.h
index f2b20b9..a0b3a33 100644
--- a/mempool/include/mempool.h
+++ b/mempool/include/mempool.h
@@ -37,7 +37,7 @@
37/// Return the ith block. 37/// Return the ith block.
38/// The block must have been allocated. 38/// The block must have been allocated.
39#define mempool_get_block(POOL, INDEX) \ 39#define mempool_get_block(POOL, INDEX) \
40 ((typeof((POOL)->blocks[0])*)mempool_get_block_(&(POOL)->pool, INDEX)) 40 ((__typeof__((POOL)->blocks[0])*)mempool_get_block_(&(POOL)->pool, INDEX))
41 41
42/// Get the index to the given block. 42/// Get the index to the given block.
43#define mempool_get_block_index(POOL, BLOCK_PTR) \ 43#define mempool_get_block_index(POOL, BLOCK_PTR) \
@@ -48,16 +48,16 @@
48/// The caller can use 'i' as the index of the current block. 48/// The caller can use 'i' as the index of the current block.
49/// 49///
50/// It is valid to mempool_free() the object at each step of the iteration. 50/// It is valid to mempool_free() the object at each step of the iteration.
51#define mempool_foreach(POOL, ITER, BODY) \ 51#define mempool_foreach(POOL, ITER, BODY) \
52 for (size_t i = 0; \ 52 for (size_t i = 0; \
53 i < (sizeof((POOL)->blocks) / sizeof(typeof((POOL)->blocks[0]))); \ 53 i < (sizeof((POOL)->blocks) / sizeof(__typeof__((POOL)->blocks[0]))); \
54 ++i) { \ 54 ++i) { \
55 if (!(POOL)->block_info[i].used) { \ 55 if (!(POOL)->block_info[i].used) { \
56 continue; \ 56 continue; \
57 } \ 57 } \
58 typeof((POOL)->blocks[0])* ITER = &(POOL)->blocks[i]; \ 58 __typeof__((POOL)->blocks[0])* ITER = &(POOL)->blocks[i]; \
59 (void)ITER; \ 59 (void)ITER; \
60 BODY; \ 60 BODY; \
61 } 61 }
62 62
63typedef struct BlockInfo { 63typedef struct BlockInfo {