diff options
| author | gingerBill <bill@gingerbill.org> | 2022-09-17 13:05:14 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2022-09-17 13:05:14 +0100 |
| commit | 40bcfc7c8df2e4e76a75f543c43f97cf9d050925 (patch) | |
| tree | a37dbc3c4dbbb02e4d7ffe99948b9356cbb03b5c | |
| parent | bfe0ffd6e6e7940d189b12df1697591f98564d60 (diff) | |
Update json/unmarshal.odin for the new `runtime.__dynamic_map_set`
| -rw-r--r-- | core/encoding/json/unmarshal.odin | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/core/encoding/json/unmarshal.odin b/core/encoding/json/unmarshal.odin index 792b1edc6..85d3303c2 100644 --- a/core/encoding/json/unmarshal.odin +++ b/core/encoding/json/unmarshal.odin @@ -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) } |