1.1 --- a/src/cx/collection.h Thu May 23 20:43:04 2024 +0200 1.2 +++ b/src/cx/collection.h Thu May 23 22:06:32 2024 +0200 1.3 @@ -100,6 +100,25 @@ 1.4 #define CX_COLLECTION_BASE struct cx_collection_s collection 1.5 1.6 /** 1.7 + * Sets a simple destructor function for this collection. 1.8 + * 1.9 + * @param c the collection 1.10 + * @param destr the destructor function 1.11 + */ 1.12 +#define cxDefineDestructor(c, destr) \ 1.13 + (c)->collection.simple_destructor = (cx_destructor_func) destr 1.14 + 1.15 +/** 1.16 + * Sets a simple destructor function for this collection. 1.17 + * 1.18 + * @param c the collection 1.19 + * @param destr the destructor function 1.20 + */ 1.21 +#define cxDefineAdvancedDestructor(c, destr, data) \ 1.22 + (c)->collection.advanced_destructor = (cx_destructor_func2) destr; \ 1.23 + (c)->collection.destructor_data = data 1.24 + 1.25 +/** 1.26 * Invokes the simple destructor function for a specific element. 1.27 * 1.28 * Usually only used by collection implementations. There should be no need