add convenience macros for pointer casts

Sun, 03 Oct 2021 18:37:13 +0200

author
Mike Becker <universe@uap-core.de>
date
Sun, 03 Oct 2021 18:37:13 +0200
changeset 458
da11a5a765a0
parent 457
8f7d3fe9ca40
child 459
c0e2e9f83399

add convenience macros for pointer casts

src/cx/list.h file | annotate | diff | comparison | revisions
--- a/src/cx/list.h	Sun Oct 03 18:36:51 2021 +0200
+++ b/src/cx/list.h	Sun Oct 03 18:37:13 2021 +0200
@@ -85,6 +85,12 @@
 
 void *cxListLast(CxList list);
 
+#define cxTypedListAdd(type, list, elem) (cxListAdd(list, (type*) (elem)))
+#define cxTypedListInsert(type, list, index, elem) (cxListInsert(list, index, (type*) (elem)))
+#define cxTypedListAt(type, list, index) ((type*)cxListAt(list, index))
+#define cxTypedListFind(type, list, elem) (cxListFind(list, (type*) (elem)))
+#define cxTypedListLast(type, list) ((type*)cxListLast(list))
+
 #ifdef __cplusplus
 } /* extern "C" */
 #endif

mercurial