# HG changeset patch # User Mike Becker # Date 1633279033 -7200 # Node ID da11a5a765a0ad4cff8f86e87dcc54870d03b4df # Parent 8f7d3fe9ca40f070214f65afa91ac96a4909c004 add convenience macros for pointer casts diff -r 8f7d3fe9ca40 -r da11a5a765a0 src/cx/list.h --- 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