Sun, 03 Oct 2021 18:37:13 +0200
add convenience macros for pointer casts
src/cx/list.h | file | annotate | diff | comparison | revisions |
1.1 --- a/src/cx/list.h Sun Oct 03 18:36:51 2021 +0200 1.2 +++ b/src/cx/list.h Sun Oct 03 18:37:13 2021 +0200 1.3 @@ -85,6 +85,12 @@ 1.4 1.5 void *cxListLast(CxList list); 1.6 1.7 +#define cxTypedListAdd(type, list, elem) (cxListAdd(list, (type*) (elem))) 1.8 +#define cxTypedListInsert(type, list, index, elem) (cxListInsert(list, index, (type*) (elem))) 1.9 +#define cxTypedListAt(type, list, index) ((type*)cxListAt(list, index)) 1.10 +#define cxTypedListFind(type, list, elem) (cxListFind(list, (type*) (elem))) 1.11 +#define cxTypedListLast(type, list) ((type*)cxListLast(list)) 1.12 + 1.13 #ifdef __cplusplus 1.14 } /* extern "C" */ 1.15 #endif