mirror of
https://github.com/golang/go
synced 2024-11-25 05:57:57 -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:
parent
bdcc0437f6
commit
a696da10e0
@ -406,7 +406,7 @@ func decUint8Array(i *decInstr, state *decoderState, p unsafe.Pointer) {
|
|||||||
func decString(i *decInstr, state *decoderState, p unsafe.Pointer) {
|
func decString(i *decInstr, state *decoderState, p unsafe.Pointer) {
|
||||||
if i.indir > 0 {
|
if i.indir > 0 {
|
||||||
if *(*unsafe.Pointer)(p) == nil {
|
if *(*unsafe.Pointer)(p) == nil {
|
||||||
*(*unsafe.Pointer)(p) = unsafe.Pointer(new([]byte))
|
*(*unsafe.Pointer)(p) = unsafe.Pointer(new(string))
|
||||||
}
|
}
|
||||||
p = *(*unsafe.Pointer)(p)
|
p = *(*unsafe.Pointer)(p)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user