Sun, 03 Oct 2021 18:37:13 +0200
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