Update json/unmarshal.odin for the new runtime.__dynamic_map_set

This commit is contained in:
gingerBill
2022-09-17 13:05:14 +01:00
parent bfe0ffd6e6
commit 40bcfc7c8d

View File

@@ -422,19 +422,17 @@ unmarshal_object :: proc(p: ^Parser, v: any, end_token: Token_Kind) -> (err: Unm
delete(key, p.allocator)
return err
}
hash := runtime.Map_Hash {
hash = runtime.default_hasher_string(&key, 0),
key_ptr = &key,
}
key_hash := runtime.default_hasher_string(&key, 0)
key_ptr := rawptr(&key)
key_cstr: cstring
if reflect.is_cstring(t.key) {
key_cstr = cstring(raw_data(key))
hash.key_ptr = &key_cstr
key_ptr = &key_cstr
}
set_ptr := runtime.__dynamic_map_set(header, hash, map_backing_value.data)
set_ptr := runtime.__dynamic_map_set(header, key_hash, key_ptr, map_backing_value.data)
if set_ptr == nil {
delete(key, p.allocator)
}