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:
2025-01-12 21:58:57 -05:00
parent 5a7b8b463b
commit ca2d0f81f0
2 changed files with 2 additions and 0 deletions
+1
View File
@@ -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
}
+1
View File
@@ -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