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
     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

mercurial