From c7747ba9b2caf9da610181fa000376f140b94152 Mon Sep 17 00:00:00 2001 From: IncSW Date: Mon, 3 May 2021 10:55:17 +0300 Subject: [PATCH] remove unnecessary assignments --- decode_slice.go | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/decode_slice.go b/decode_slice.go index c85482b..0198ab0 100644 --- a/decode_slice.go +++ b/decode_slice.go @@ -131,18 +131,13 @@ func (d *sliceDecoder) decodeStream(s *stream, depth int64, p unsafe.Pointer) er slice.cap = capacity slice.len = idx + 1 slice.data = data - dst := *(*sliceHeader)(p) + dst := (*sliceHeader)(p) dst.len = idx + 1 if dst.len > dst.cap { dst.data = newArray(d.elemType, dst.len) dst.cap = dst.len } - copySlice(d.elemType, dst, sliceHeader{ - data: slice.data, - len: slice.len, - cap: slice.cap, - }) - *(*sliceHeader)(p) = dst + copySlice(d.elemType, *dst, *slice) d.releaseSlice(slice) s.cursor++ return nil @@ -247,18 +242,13 @@ func (d *sliceDecoder) decode(buf []byte, cursor, depth int64, p unsafe.Pointer) slice.cap = capacity slice.len = idx + 1 slice.data = data - dst := *(*sliceHeader)(p) + dst := (*sliceHeader)(p) dst.len = idx + 1 if dst.len > dst.cap { dst.data = newArray(d.elemType, dst.len) dst.cap = dst.len } - copySlice(d.elemType, dst, sliceHeader{ - data: slice.data, - len: slice.len, - cap: slice.cap, - }) - **(**sliceHeader)(unsafe.Pointer(&p)) = dst + copySlice(d.elemType, *dst, *slice) d.releaseSlice(slice) cursor++ return cursor, nil