diff options
| author | Mattias Andrée <m@maandree.se> | 2026-05-10 22:05:40 +0200 |
|---|---|---|
| committer | Mattias Andrée <m@maandree.se> | 2026-05-10 22:05:40 +0200 |
| commit | 266ffbc3e61570d08ec0ec84394ab49eb9b44e7d (patch) | |
| tree | b6d891b955240beb90409d86a67ac209cdb49e8d /libtest/alloc.c | |
| parent | Improvements to libtest (diff) | |
| download | librecrypt-266ffbc3e61570d08ec0ec84394ab49eb9b44e7d.tar.gz librecrypt-266ffbc3e61570d08ec0ec84394ab49eb9b44e7d.tar.bz2 librecrypt-266ffbc3e61570d08ec0ec84394ab49eb9b44e7d.tar.xz | |
Misc
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to '')
| -rw-r--r-- | libtest/alloc.c | 62 |
1 files changed, 37 insertions, 25 deletions
diff --git a/libtest/alloc.c b/libtest/alloc.c index 65eda04..7752091 100644 --- a/libtest/alloc.c +++ b/libtest/alloc.c @@ -252,22 +252,26 @@ PURE size_t void (free)(void *ptr) { - libtest_free_is_custom = 1; + if (libtest_free_is_custom < 0) { + libtest_free_is_custom = 1; - assert(libtest_have_custom_malloc()); - assert(libtest_have_custom_calloc()); - assert(libtest_have_custom_realloc()); - assert(libtest_have_custom_reallocarray()); - assert(libtest_have_custom_valloc()); - assert(libtest_have_custom_pvalloc()); - assert(libtest_have_custom_memalign()); - assert(libtest_have_custom_aligned_alloc()); - assert(libtest_have_custom_posix_memalign()); - assert(libtest_have_custom_strdup()); - assert(libtest_have_custom_strndup()); - assert(libtest_have_custom_wcsdup()); - assert(libtest_have_custom_wcsdup()); - assert(libtest_have_custom_memdup()); + assert(libtest_have_custom_malloc()); + assert(libtest_have_custom_calloc()); + assert(libtest_have_custom_realloc()); + assert(libtest_have_custom_reallocarray()); + assert(libtest_have_custom_valloc()); + assert(libtest_have_custom_pvalloc()); + assert(libtest_have_custom_memalign()); + assert(libtest_have_custom_aligned_alloc()); + assert(libtest_have_custom_posix_memalign()); + assert(libtest_have_custom_strdup()); + assert(libtest_have_custom_strndup()); + assert(libtest_have_custom_wcsdup()); + assert(libtest_have_custom_wcsndup()); + assert(libtest_have_custom_memdup()); + } + + libtest_free_is_custom = 1; if (ptr) { struct meminfo *meminfo; @@ -285,13 +289,17 @@ void void (free_sized)(void *ptr, size_t size) { - libtest_free_sized_is_custom = 1; + if (libtest_free_sized_is_custom < 0) { + libtest_free_sized_is_custom = 1; - assert(libtest_have_custom_malloc()); - assert(libtest_have_custom_calloc()); - assert(libtest_have_custom_realloc()); - assert(libtest_have_custom_reallocarray()); - assert(libtest_have_custom_memdup()); + assert(libtest_have_custom_malloc()); + assert(libtest_have_custom_calloc()); + assert(libtest_have_custom_realloc()); + assert(libtest_have_custom_reallocarray()); + assert(libtest_have_custom_memdup()); + } + + libtest_free_sized_is_custom = 1; if (ptr) { struct meminfo *meminfo; @@ -307,11 +315,15 @@ void void (free_aligned_sized)(void *ptr, size_t alignment, size_t size) { - libtest_free_aligned_sized_is_custom = 1; + if (libtest_free_aligned_sized_is_custom < 0) { + libtest_free_aligned_sized_is_custom = 1; - assert(libtest_have_custom_memalign()); - assert(libtest_have_custom_aligned_alloc()); - assert(libtest_have_custom_posix_memalign()); + assert(libtest_have_custom_memalign()); + assert(libtest_have_custom_aligned_alloc()); + assert(libtest_have_custom_posix_memalign()); + } + + libtest_free_aligned_sized_is_custom = 1; if (ptr) { struct meminfo *meminfo; |
