diff -r 6bbbf219251d -r 4d12e34bb130 src/cx/collection.h --- a/src/cx/collection.h Thu May 23 20:43:04 2024 +0200 +++ b/src/cx/collection.h Thu May 23 22:06:32 2024 +0200 @@ -100,6 +100,25 @@ #define CX_COLLECTION_BASE struct cx_collection_s collection /** + * Sets a simple destructor function for this collection. + * + * @param c the collection + * @param destr the destructor function + */ +#define cxDefineDestructor(c, destr) \ + (c)->collection.simple_destructor = (cx_destructor_func) destr + +/** + * Sets a simple destructor function for this collection. + * + * @param c the collection + * @param destr the destructor function + */ +#define cxDefineAdvancedDestructor(c, destr, data) \ + (c)->collection.advanced_destructor = (cx_destructor_func2) destr; \ + (c)->collection.destructor_data = data + +/** * Invokes the simple destructor function for a specific element. * * Usually only used by collection implementations. There should be no need