Add mem_allocator realloc_array Macros (#2760)

* Add mem_allocator `realloc_array` Macros

* test, ensure `realloc_array` to 0 size returns `null`

* update release notes

---------

Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
This commit is contained in:
Zack Puhl
2026-01-25 10:12:44 -05:00
committed by GitHub
parent 6cffb888ea
commit 75d454b6a6
3 changed files with 33 additions and 0 deletions

View File

@@ -23,3 +23,10 @@ fn void test_new_aligned_compiles() @test
Bar* bar = allocator::new_aligned(mem, Bar, {.x = 1, .y = 2, .foos = {}})!!;
allocator::free_aligned(mem, bar);
}
fn void test_realloc_array_to_zero() @test
{
usz* x = mem::talloc_array(usz, 24);
x = allocator::realloc_array(tmem, x, usz, 0);
test::@check(x == null, "Zero-sized reallocation's pointer is not null: %p", x);
}