From 75abeca4a9d606bee89a41475f2f451187fec127 Mon Sep 17 00:00:00 2001
From: 3gg <3gg@shellblade.net>
Date: Sat, 4 Feb 2023 18:17:39 -0800
Subject: More compliance with C11.

---
 mempool/include/mempool.h | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

(limited to 'mempool/include')

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 @@
 /// Return the ith block.
 /// The block must have been allocated.
 #define mempool_get_block(POOL, INDEX) \
-  ((typeof((POOL)->blocks[0])*)mempool_get_block_(&(POOL)->pool, INDEX))
+  ((__typeof__((POOL)->blocks[0])*)mempool_get_block_(&(POOL)->pool, INDEX))
 
 /// Get the index to the given block.
 #define mempool_get_block_index(POOL, BLOCK_PTR) \
@@ -48,16 +48,16 @@
 /// The caller can use 'i' as the index of the current block.
 ///
 /// It is valid to mempool_free() the object at each step of the iteration.
-#define mempool_foreach(POOL, ITER, BODY)                                \
-  for (size_t i = 0;                                                     \
-       i < (sizeof((POOL)->blocks) / sizeof(typeof((POOL)->blocks[0]))); \
-       ++i) {                                                            \
-    if (!(POOL)->block_info[i].used) {                                   \
-      continue;                                                          \
-    }                                                                    \
-    typeof((POOL)->blocks[0])* ITER = &(POOL)->blocks[i];                \
-    (void)ITER;                                                          \
-    BODY;                                                                \
+#define mempool_foreach(POOL, ITER, BODY)                                    \
+  for (size_t i = 0;                                                         \
+       i < (sizeof((POOL)->blocks) / sizeof(__typeof__((POOL)->blocks[0]))); \
+       ++i) {                                                                \
+    if (!(POOL)->block_info[i].used) {                                       \
+      continue;                                                              \
+    }                                                                        \
+    __typeof__((POOL)->blocks[0])* ITER = &(POOL)->blocks[i];                \
+    (void)ITER;                                                              \
+    BODY;                                                                    \
   }
 
 typedef struct BlockInfo {
-- 
cgit v1.2.3