commit a2f0d5c60438905c14ec25763a6704a542175275
parent 2dedef6f6c1216985d73e00be1bc63758dac1bd3
Author: Louis Burda <quent.burda@gmail.com>
Date: Sun, 9 Apr 2023 10:18:59 -0400
Remove typeof from LIST_UPCAST for standard C compliance
Diffstat:
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/include/list.h b/include/list.h
@@ -6,9 +6,8 @@
#define LIST_LINK_INIT ((struct list_link) { 0 })
#define LIST_OFFSET(type, member) ((size_t) &((type *)0)->member)
-#define LIST_UPCAST(ptr, type, member) ({ \
- const typeof( ((type *)0)->member ) *__mptr = (ptr); \
- (type *)( (char *)__mptr - LIST_OFFSET(type, member) ); })
+#define LIST_UPCAST(ptr, type, member) \
+ ((type *)((char *)ptr - LIST_OFFSET(type, member)))
#define LIST_INNER(link) ((link) != NULL && \
(link)->prev != NULL && (link)->next != NULL)