src/cx/allocator.h

changeset 726
44986c0e2b05
parent 677
b09aae58bba4
     1.1 --- a/src/cx/allocator.h	Tue Jun 27 20:04:48 2023 +0200
     1.2 +++ b/src/cx/allocator.h	Wed Jun 28 19:18:01 2023 +0200
     1.3 @@ -133,6 +133,22 @@
     1.4  ) __attribute__((__nonnull__(2)));
     1.5  
     1.6  /**
     1.7 + * Re-allocate a previously allocated block and changes the pointer in-place, if necessary.
     1.8 + *
     1.9 + * \par Error handling
    1.10 + * \c errno will be set by realloc() on failure.
    1.11 + *
    1.12 + * @param mem pointer to the pointer to allocated block
    1.13 + * @param n the new size in bytes
    1.14 + * @return zero on success, non-zero on failure
    1.15 + */
    1.16 +int cx_reallocate(
    1.17 +        void **mem,
    1.18 +        size_t n
    1.19 +)
    1.20 +__attribute__((__nonnull__));
    1.21 +
    1.22 +/**
    1.23   * Allocate \p n bytes of memory.
    1.24   *
    1.25   * @param allocator the allocator
    1.26 @@ -169,7 +185,6 @@
    1.27  /**
    1.28   * Re-allocate a previously allocated block and changes the pointer in-place, if necessary.
    1.29   * This function acts like cxRealloc() using the pointer pointed to by \p mem.
    1.30 - * On success, the pointer is changed to the new location (in case the
    1.31   *
    1.32   * \note Re-allocating a block allocated by a different allocator is undefined.
    1.33   *

mercurial