mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user