1
0
mirror of https://github.com/golang/go synced 2024-11-22 01:54:42 -07:00

gob: when decoding a string, allocate a string, not a []byte.

R=r, r2
CC=golang-dev
https://golang.org/cl/4430042
This commit is contained in:
Ian Lance Taylor 2011-04-15 06:49:39 -07:00
parent bdcc0437f6
commit a696da10e0

View File

@ -406,7 +406,7 @@ func decUint8Array(i *decInstr, state *decoderState, p unsafe.Pointer) {
func decString(i *decInstr, state *decoderState, p unsafe.Pointer) {
if i.indir > 0 {
if *(*unsafe.Pointer)(p) == nil {
*(*unsafe.Pointer)(p) = unsafe.Pointer(new([]byte))
*(*unsafe.Pointer)(p) = unsafe.Pointer(new(string))
}
p = *(*unsafe.Pointer)(p)
}