diff -r a43ed636d1ff -r 312fb24c14de src/cx/allocator.h --- 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