mirror of https://github.com/goccy/go-json.git
Keep reference of interface value
This commit is contained in:
parent
024abcd29d
commit
66b8cb792a
|
@ -28,11 +28,13 @@ func mapassign(t *rtype, m unsafe.Pointer, key, val unsafe.Pointer)
|
||||||
|
|
||||||
func (d *mapDecoder) setKey(buf []byte, cursor int64, key interface{}) (int64, error) {
|
func (d *mapDecoder) setKey(buf []byte, cursor int64, key interface{}) (int64, error) {
|
||||||
header := (*interfaceHeader)(unsafe.Pointer(&key))
|
header := (*interfaceHeader)(unsafe.Pointer(&key))
|
||||||
|
d.dummy = header
|
||||||
return d.keyDecoder.decode(buf, cursor, uintptr(header.ptr))
|
return d.keyDecoder.decode(buf, cursor, uintptr(header.ptr))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *mapDecoder) setValue(buf []byte, cursor int64, key interface{}) (int64, error) {
|
func (d *mapDecoder) setValue(buf []byte, cursor int64, key interface{}) (int64, error) {
|
||||||
header := (*interfaceHeader)(unsafe.Pointer(&key))
|
header := (*interfaceHeader)(unsafe.Pointer(&key))
|
||||||
|
d.dummy = header
|
||||||
return d.valueDecoder.decode(buf, cursor, uintptr(header.ptr))
|
return d.valueDecoder.decode(buf, cursor, uintptr(header.ptr))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue