diff options
author | Phil Jones <philj56@gmail.com> | 2022-08-02 13:32:29 +0100 |
---|---|---|
committer | Phil Jones <philj56@gmail.com> | 2022-08-02 13:32:29 +0100 |
commit | 85b85d735594ce9c1fe5db57fc5bd8cd1cddf45e (patch) | |
tree | 7d400edb216daa80a7768183479be8d277fe85c5 | |
parent | f90d6dd13dc6f6c4ca80174a8f3c17f37893b1ef (diff) |
Add a few more function attributes.
-rw-r--r-- | src/string_vec.h | 2 | ||||
-rw-r--r-- | src/xmalloc.h | 10 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/string_vec.h b/src/string_vec.h index 64b3d46..7402052 100644 --- a/src/string_vec.h +++ b/src/string_vec.h @@ -22,6 +22,7 @@ struct string_vec string_vec_create(void); void string_vec_destroy(struct string_vec *restrict vec); +[[nodiscard("memory leaked")]] struct string_vec string_vec_copy(struct string_vec *restrict vec); void string_vec_add(struct string_vec *restrict vec, const char *restrict str); @@ -37,6 +38,7 @@ struct string_vec string_vec_filter( const struct string_vec *restrict vec, const char *restrict substr); +[[nodiscard("memory leaked")]] struct string_vec string_vec_load(FILE *file); void string_vec_save(struct string_vec *restrict vec, FILE *restrict file); diff --git a/src/xmalloc.h b/src/xmalloc.h index 747509c..cf35712 100644 --- a/src/xmalloc.h +++ b/src/xmalloc.h @@ -3,15 +3,19 @@ #include <stdlib.h> -__attribute__((malloc)) +[[nodiscard("memory leaked")]] +[[gnu::malloc]] void *xmalloc(size_t size); -__attribute__((malloc)) +[[nodiscard("memory leaked")]] +[[gnu::malloc]] void *xcalloc(size_t nmemb, size_t size); +[[nodiscard("memory leaked")]] void *xrealloc(void *ptr, size_t size); -__attribute__((malloc)) +[[nodiscard("memory leaked")]] +[[gnu::malloc]] char *xstrdup(const char *s); #endif /* XMALLOC_H */ |