src/cx/allocator.h

changeset 452
a10c3e127050
parent 450
7960298039cf
child 461
005c2791c2e2
     1.1 --- a/src/cx/allocator.h	Sun Oct 03 12:04:27 2021 +0200
     1.2 +++ b/src/cx/allocator.h	Sun Oct 03 13:07:48 2021 +0200
     1.3 @@ -121,7 +121,7 @@
     1.4   * @return a pointer to the allocated memory
     1.5   */
     1.6  void *cxMalloc(CxAllocator allocator, size_t n)
     1.7 -__attribute__((__malloc__));
     1.8 +__attribute__((__malloc__, __alloc_size__(2)));
     1.9  
    1.10  /**
    1.11   * Re-allocate the previously allocated block in \p mem, making the new block \p n bytes long.
    1.12 @@ -136,7 +136,7 @@
    1.13   * @return a pointer to the re-allocated memory
    1.14   */
    1.15  void *cxRealloc(CxAllocator allocator, void *mem, size_t n)
    1.16 -__attribute__((warn_unused_result));
    1.17 +__attribute__((__warn_unused_result__, __alloc_size__(3)));
    1.18  
    1.19  /**
    1.20   * Re-allocate a previously allocated block and changes the pointer in-place, if necessary.
    1.21 @@ -154,7 +154,7 @@
    1.22   * @return zero on success, non-zero on failure
    1.23   */
    1.24  int cxReallocate(CxAllocator allocator, void **mem, size_t n)
    1.25 -__attribute__((nonnull));
    1.26 +__attribute__((__nonnull__));
    1.27  
    1.28  /**
    1.29   * Allocate \p nelem elements of \p n bytes each, all initialized to zero.
    1.30 @@ -165,7 +165,7 @@
    1.31   * @return a pointer to the allocated memory
    1.32   */
    1.33  void *cxCalloc(CxAllocator allocator, size_t nelem, size_t n)
    1.34 -__attribute__((malloc));
    1.35 +__attribute__((__malloc__, __alloc_size__(2, 3)));
    1.36  
    1.37  /**
    1.38   * Free a block allocated by this allocator.
    1.39 @@ -176,7 +176,7 @@
    1.40   * @param mem a pointer to the block to free
    1.41   */
    1.42  void cxFree(CxAllocator allocator, void *mem)
    1.43 -__attribute__((nonnull));
    1.44 +__attribute__((__nonnull__));
    1.45  
    1.46  #ifdef __cplusplus
    1.47  } /* extern "C" */

mercurial