diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2023-12-20 18:35:58 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2023-12-20 20:19:18 -0500 |
commit | cbbcb340c974fca7312713d2515e3b32bacb176f (patch) | |
tree | e22aec211da8c6a704d109748b2415515ad22da7 /src | |
parent | 2f3653bf522ce079501254bfd34abbf884dc528e (diff) | |
download | bfs-cbbcb340c974fca7312713d2515e3b32bacb176f.tar.xz |
alloc: Add attr(nodiscard) to a few functions
Diffstat (limited to 'src')
-rw-r--r-- | src/alloc.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/alloc.h b/src/alloc.h index f21ddb9..60dd738 100644 --- a/src/alloc.h +++ b/src/alloc.h @@ -168,6 +168,7 @@ void *zalloc(size_t align, size_t size); * @return * The reallocated memory, or NULL on failure. */ +attr(nodiscard, aligned_alloc(2, 4)) void *xrealloc(void *ptr, size_t align, size_t old_size, size_t new_size); /** Reallocate memory for an array. */ @@ -193,6 +194,7 @@ void *xrealloc(void *ptr, size_t align, size_t old_size, size_t new_size); * for (count + 1) elements. On failure, errno will be non-zero, and * ptr will returned unchanged. */ +attr(nodiscard) void *reserve(void *ptr, size_t align, size_t size, size_t count); /** @@ -349,6 +351,7 @@ void *varena_alloc(struct varena *varena, size_t count); * @return * The resized struct, or NULL on failure. */ +attr(nodiscard) void *varena_realloc(struct varena *varena, void *ptr, size_t old_count, size_t new_count); /** @@ -363,6 +366,7 @@ void *varena_realloc(struct varena *varena, void *ptr, size_t old_count, size_t * @return * The resized struct, or NULL on failure. */ +attr(nodiscard) void *varena_grow(struct varena *varena, void *ptr, size_t *count); /** |