mirror of
https://github.com/json-iterator/go.git
synced 2024-11-24 08:22:14 +02:00
#140 blind fix
This commit is contained in:
parent
b67201557a
commit
abbd16da6c
@ -133,9 +133,9 @@ func growOne(slice *sliceHeader, sliceType reflect.Type, elementType reflect.Typ
|
|||||||
for i := uintptr(0); i < originalBytesCount; i++ {
|
for i := uintptr(0); i < originalBytesCount; i++ {
|
||||||
dstPtr[i] = srcPtr[i]
|
dstPtr[i] = srcPtr[i]
|
||||||
}
|
}
|
||||||
|
slice.Data = dst
|
||||||
slice.Len = newLen
|
slice.Len = newLen
|
||||||
slice.Cap = newCap
|
slice.Cap = newCap
|
||||||
slice.Data = dst
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func reuseSlice(slice *sliceHeader, sliceType reflect.Type, expectedCap int) {
|
func reuseSlice(slice *sliceHeader, sliceType reflect.Type, expectedCap int) {
|
||||||
@ -144,6 +144,6 @@ func reuseSlice(slice *sliceHeader, sliceType reflect.Type, expectedCap int) {
|
|||||||
}
|
}
|
||||||
newVal := reflect.MakeSlice(sliceType, 0, expectedCap)
|
newVal := reflect.MakeSlice(sliceType, 0, expectedCap)
|
||||||
dst := unsafe.Pointer(newVal.Pointer())
|
dst := unsafe.Pointer(newVal.Pointer())
|
||||||
slice.Cap = expectedCap
|
|
||||||
slice.Data = dst
|
slice.Data = dst
|
||||||
|
slice.Cap = expectedCap
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user