remove useless dstCap var

This commit is contained in:
IncSW 2021-04-30 20:07:44 +03:00
parent 2ad2f11326
commit e6ff77fe8d
No known key found for this signature in database
GPG Key ID: 89876FA64BFB2D57
1 changed files with 6 additions and 8 deletions

View File

@ -133,10 +133,9 @@ func (d *sliceDecoder) decodeStream(s *stream, depth int64, p unsafe.Pointer) er
slice.data = data
dst := *(*sliceHeader)(p)
dst.len = idx + 1
dstCap := idx + 1
if dstCap > dst.cap {
dst.data = newArray(d.elemType, dstCap)
dst.cap = dstCap
if dst.len > dst.cap {
dst.data = newArray(d.elemType, dst.len)
dst.cap = dst.len
}
copySlice(d.elemType, dst, sliceHeader{
data: slice.data,
@ -250,10 +249,9 @@ func (d *sliceDecoder) decode(buf []byte, cursor, depth int64, p unsafe.Pointer)
slice.data = data
dst := *(*sliceHeader)(p)
dst.len = idx + 1
dstCap := idx + 1
if dstCap > dst.cap {
dst.data = newArray(d.elemType, dstCap)
dst.cap = dstCap
if dst.len > dst.cap {
dst.data = newArray(d.elemType, dst.len)
dst.cap = dst.len
}
copySlice(d.elemType, dst, sliceHeader{
data: slice.data,