Removed implicit assignments for container allocators in the Base and Core packages

This commit is contained in:
2025-01-12 21:41:15 -05:00
parent 37ec315a91
commit 5a7b8b463b
11 changed files with 77 additions and 40 deletions
+2
View File
@@ -692,6 +692,8 @@ _unmarshal_map :: proc(d: Decoder, v: any, ti: ^reflect.Type_Info, hdr: Header,
case reflect.Type_Info_Map:
raw_map := (^mem.Raw_Map)(v.data)
if raw_map.allocator.procedure == nil {
// Note(Ed) - Sectr Fork: I'm premmtively leaving this here incase it happens...
runtime.debug_trap()
raw_map.allocator = context.allocator
}
+2
View File
@@ -526,6 +526,8 @@ unmarshal_object :: proc(p: ^Parser, v: any, end_token: Token_Kind) -> (err: Unm
}
raw_map := (^mem.Raw_Map)(v.data)
if raw_map.allocator.procedure == nil {
// Note(Ed) - Sectr Fork: I'm premmtively leaving this here incase it happens...
runtime.debug_trap()
raw_map.allocator = p.allocator
}
+8 -3
View File
@@ -203,9 +203,14 @@ set_key_value :: proc(model: ^$T, parser: ^Parser, name, key, value: string) ->
elem_backing: []byte
value_ptr: rawptr
if raw_map.allocator.procedure == nil {
raw_map.allocator = context.allocator
} else {
assert(raw_map.allocator.procedure != nil)
// Note(Ed) - Sectr Fork: Not a fan. (I want it to assert)
// if raw_map.allocator.procedure == nil {
// raw_map.allocator = context.allocator
// }
// else
{
value_ptr = runtime.__dynamic_map_get(raw_map,
specific_type_info.map_info,
hash,
+5 -3
View File
@@ -232,9 +232,11 @@ tracking_allocator_proc :: proc(
}
result_ptr := raw_data(result)
if data.allocation_map.allocator.procedure == nil {
data.allocation_map.allocator = context.allocator
}
// Note(Ed) - Sectr Fork: Not a fan. (I want it to assert)
// if data.allocation_map.allocator.procedure == nil {
// data.allocation_map.allocator = context.allocator
// }
assert(data.allocation_map.allocator.procedure != nil)
switch mode {
case .Alloc, .Alloc_Non_Zeroed:
+4 -3
View File
@@ -105,9 +105,10 @@ Returns:
- err: An allocator error if one occured, `nil` otherwise
*/
_intern_get_entry :: proc(m: ^Intern, text: string) -> (new_entry: ^Intern_Entry, err: runtime.Allocator_Error) #no_bounds_check {
if m.allocator.procedure == nil {
m.allocator = context.allocator
}
// Note(Ed) - Sectr Fork: Not a fan. (I want it to assert)
// if m.allocator.procedure == nil {
// m.allocator = context.allocator
// }
key_ptr, val_ptr, inserted := map_entry(&m.entries, text) or_return
if !inserted {