changes cxFreeDefault() from a macro to a function so that it can be used as a simple destructor

Sun, 07 Dec 2025 15:33:16 +0100

author
Mike Becker <universe@uap-core.de>
date
Sun, 07 Dec 2025 15:33:16 +0100
changeset 1554
91fb10c89611
parent 1553
7c46531efd52
child 1555
8972247f54e8

changes cxFreeDefault() from a macro to a function so that it can be used as a simple destructor

src/allocator.c file | annotate | diff | comparison | revisions
src/cx/allocator.h file | annotate | diff | comparison | revisions
--- a/src/allocator.c	Sun Dec 07 13:24:18 2025 +0100
+++ b/src/allocator.c	Sun Dec 07 15:33:16 2025 +0100
@@ -243,3 +243,7 @@
 ) {
     allocator->cl->free(allocator->data, mem);
 }
+
+void cxFreeDefault(void *mem) {
+    cxDefaultAllocator->cl->free(cxDefaultAllocator->data, mem);
+}
--- a/src/cx/allocator.h	Sun Dec 07 13:24:18 2025 +0100
+++ b/src/cx/allocator.h	Sun Dec 07 15:33:16 2025 +0100
@@ -439,9 +439,9 @@
  */
 #define cxReallocArrayDefault(...) cxReallocArray(cxDefaultAllocator, __VA_ARGS__)
 /**
- * Convenience macro that invokes cxFree() with the cxDefaultAllocator.
+ * Convenience function that invokes cxFree() with the cxDefaultAllocator.
  */
-#define cxFreeDefault(...) cxFree(cxDefaultAllocator, __VA_ARGS__)
+CX_EXPORT void cxFreeDefault(void *mem);
 
 #ifdef __cplusplus
 } // extern "C"

mercurial