Skip to content

Commit

Permalink
[mem]: Don't use named params for dynamic pool in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
flysand7 committed Sep 8, 2024
1 parent 05df34f commit 167ced8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions core/mem/allocators.odin
Original file line number Diff line number Diff line change
Expand Up @@ -1564,20 +1564,20 @@ arrays of blocks and out-band blocks. The blocks have the default size of
will be aligned to a boundary specified by `alignment`.
*/
dynamic_arena_init :: proc(
a: ^Dynamic_Arena,
pool: ^Dynamic_Arena,
block_allocator := context.allocator,
array_allocator := context.allocator,
block_size := DYNAMIC_ARENA_BLOCK_SIZE_DEFAULT,
out_band_size := DYNAMIC_ARENA_OUT_OF_BAND_SIZE_DEFAULT,
alignment := DEFAULT_ALIGNMENT,
) {
a.block_size = block_size
a.out_band_size = out_band_size
a.alignment = alignment
a.block_allocator = block_allocator
a.out_band_allocations.allocator = array_allocator
a.unused_blocks.allocator = array_allocator
a.used_blocks.allocator = array_allocator
pool.block_size = block_size
pool.out_band_size = out_band_size
pool.alignment = alignment
pool.block_allocator = block_allocator
pool.out_band_allocations.allocator = array_allocator
pool.unused_blocks.allocator = array_allocator
pool.used_blocks.allocator = array_allocator
}

/*
Expand Down
4 changes: 2 additions & 2 deletions tests/core/mem/test_mem_dynamic_pool.odin
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import "core:mem"

expect_pool_allocation :: proc(t: ^testing.T, expected_used_bytes, num_bytes, alignment: int) {
pool: mem.Dynamic_Pool
mem.dynamic_pool_init(pool = &pool, alignment = alignment)
mem.dynamic_pool_init(&pool, alignment = alignment)
pool_allocator := mem.dynamic_pool_allocator(&pool)

element, err := mem.alloc(num_bytes, alignment, pool_allocator)
Expand Down Expand Up @@ -48,7 +48,7 @@ expect_pool_allocation_out_of_band :: proc(t: ^testing.T, num_bytes, out_band_si
testing.expect(t, num_bytes >= out_band_size, "Sanity check failed, your test call is flawed! Make sure that num_bytes >= out_band_size!")

pool: mem.Dynamic_Pool
mem.dynamic_pool_init(pool = &pool, out_band_size = out_band_size)
mem.dynamic_pool_init(&pool, out_band_size = out_band_size)
pool_allocator := mem.dynamic_pool_allocator(&pool)

element, err := mem.alloc(num_bytes, allocator = pool_allocator)
Expand Down

0 comments on commit 167ced8

Please sign in to comment.