mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-13 01:21:38 -07:00
Set allocator in base:runtime/core_builtin: make_map_cap & base:runtime/core_builtin_soa: make_soa_dynamic_array_len
This commit is contained in:
@@ -403,6 +403,7 @@ make_map_cap :: proc($T: typeid/map[$K]$E, #any_int capacity: int, allocator :=
|
||||
make_map_expr_error_loc(loc, capacity)
|
||||
context.allocator = allocator
|
||||
|
||||
m.allocator = allocator
|
||||
err = reserve_map(&m, capacity, loc)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -159,6 +159,7 @@ make_soa_dynamic_array_len :: proc($T: typeid/#soa[dynamic]$E, #any_int length:
|
||||
@(builtin, require_results)
|
||||
make_soa_dynamic_array_len_cap :: proc($T: typeid/#soa[dynamic]$E, #any_int length, capacity: int, allocator := context.allocator, loc := #caller_location) -> (array: T, err: Allocator_Error) #optional_allocator_error {
|
||||
context.allocator = allocator
|
||||
array.allocator = allocator
|
||||
reserve_soa(&array, capacity, loc) or_return
|
||||
resize_soa(&array, length, loc) or_return
|
||||
return array, nil
|
||||
|
||||
Reference in New Issue
Block a user