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
+6 -8
View File
@@ -422,19 +422,17 @@ unmarshal_object :: proc(p: ^Parser, v: any, end_token: Token_Kind) -> (err: Unm
delete(key, p.allocator) delete(key, p.allocator)
return err return err
} }
hash := runtime.Map_Hash { key_hash := runtime.default_hasher_string(&key, 0)
hash = runtime.default_hasher_string(&key, 0), key_ptr := rawptr(&key)
key_ptr = &key,
}
key_cstr: cstring key_cstr: cstring
if reflect.is_cstring(t.key) { if reflect.is_cstring(t.key) {
key_cstr = cstring(raw_data(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 { if set_ptr == nil {
delete(key, p.allocator) delete(key, p.allocator)
} }