src/cx/allocator.h

changeset 935
312fb24c14de
parent 891
49d8cff6f0ee
child 963
2f601274bbac
--- a/src/cx/allocator.h	Sat Oct 19 13:49:44 2024 +0200
+++ b/src/cx/allocator.h	Sat Oct 19 14:24:26 2024 +0200
@@ -151,6 +151,18 @@
 );
 
 /**
+ * Re-allocate a previously allocated block and changes the pointer in-place, if necessary.
+ *
+ * \par Error handling
+ * \c errno will be set by realloc() on failure.
+ *
+ * @param mem pointer to the pointer to allocated block
+ * @param n the new size in bytes
+ * @return zero on success, non-zero on failure
+ */
+#define cx_reallocate(mem, n) cx_reallocate((void**)(mem), n)
+
+/**
  * Allocate \p n bytes of memory.
  *
  * @param allocator the allocator

mercurial