diff --git a/decode_interface.go b/decode_interface.go index 455b395..d9fbad7 100644 --- a/decode_interface.go +++ b/decode_interface.go @@ -6,8 +6,7 @@ import ( ) type interfaceDecoder struct { - typ *rtype - dummy unsafe.Pointer // for escape value + typ *rtype } func newInterfaceDecoder(typ *rtype) *interfaceDecoder { @@ -40,7 +39,6 @@ func (d *interfaceDecoder) decodeStream(s *stream, p unsafe.Pointer) error { case '{': var v map[string]interface{} ptr := unsafe.Pointer(&v) - d.dummy = ptr if err := newMapDecoder( interfaceMapType, newStringDecoder(), @@ -53,7 +51,6 @@ func (d *interfaceDecoder) decodeStream(s *stream, p unsafe.Pointer) error { case '[': var v []interface{} ptr := unsafe.Pointer(&v) - d.dummy = ptr // escape ptr if err := newSliceDecoder( newInterfaceDecoder(d.typ), d.typ, @@ -122,7 +119,6 @@ func (d *interfaceDecoder) decode(buf []byte, cursor int64, p unsafe.Pointer) (i case '{': var v map[string]interface{} ptr := unsafe.Pointer(&v) - d.dummy = ptr dec := newMapDecoder( interfaceMapType, newStringDecoder(), @@ -137,7 +133,6 @@ func (d *interfaceDecoder) decode(buf []byte, cursor int64, p unsafe.Pointer) (i case '[': var v []interface{} ptr := unsafe.Pointer(&v) - d.dummy = ptr // escape ptr dec := newSliceDecoder( newInterfaceDecoder(d.typ), d.typ, diff --git a/decode_map.go b/decode_map.go index ed8a442..097805b 100644 --- a/decode_map.go +++ b/decode_map.go @@ -8,7 +8,6 @@ type mapDecoder struct { mapType *rtype keyDecoder decoder valueDecoder decoder - dummy *interfaceHeader } func newMapDecoder(mapType *rtype, keyDec decoder, valueDec decoder) *mapDecoder { @@ -28,25 +27,21 @@ func mapassign(t *rtype, m unsafe.Pointer, key, val unsafe.Pointer) func (d *mapDecoder) setKey(buf []byte, cursor int64, key interface{}) (int64, error) { header := (*interfaceHeader)(unsafe.Pointer(&key)) - d.dummy = header return d.keyDecoder.decode(buf, cursor, header.ptr) } func (d *mapDecoder) setValue(buf []byte, cursor int64, key interface{}) (int64, error) { header := (*interfaceHeader)(unsafe.Pointer(&key)) - d.dummy = header return d.valueDecoder.decode(buf, cursor, header.ptr) } func (d *mapDecoder) setKeyStream(s *stream, key interface{}) error { header := (*interfaceHeader)(unsafe.Pointer(&key)) - d.dummy = header return d.keyDecoder.decodeStream(s, header.ptr) } func (d *mapDecoder) setValueStream(s *stream, key interface{}) error { header := (*interfaceHeader)(unsafe.Pointer(&key)) - d.dummy = header return d.valueDecoder.decodeStream(s, header.ptr) }