diff options
Diffstat (limited to 'mempool/include')
-rw-r--r-- | mempool/include/mempool.h | 22 |
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 | ||
63 | typedef struct BlockInfo { | 63 | typedef struct BlockInfo { |