forked from mirror/go-json
Use NoEscapedString
This commit is contained in:
parent
af9168203a
commit
135a3c0cfb
10
encode_vm.go
10
encode_vm.go
|
@ -301,11 +301,7 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errMarshaler(code, err)
|
return nil, errMarshaler(code, err)
|
||||||
}
|
}
|
||||||
if e.enabledHTMLEscape {
|
b = encodeNoEscapedString(b, *(*string)(unsafe.Pointer(&bytes)))
|
||||||
b = encodeEscapedString(b, *(*string)(unsafe.Pointer(&bytes)))
|
|
||||||
} else {
|
|
||||||
b = encodeNoEscapedString(b, *(*string)(unsafe.Pointer(&bytes)))
|
|
||||||
}
|
|
||||||
b = encodeComma(b)
|
b = encodeComma(b)
|
||||||
}
|
}
|
||||||
code = code.next
|
code = code.next
|
||||||
|
@ -3501,7 +3497,7 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
b = append(b, code.key...)
|
b = append(b, code.key...)
|
||||||
b = encodeEscapedString(b, *(*string)(unsafe.Pointer(&bytes)))
|
b = encodeNoEscapedString(b, *(*string)(unsafe.Pointer(&bytes)))
|
||||||
b = encodeComma(b)
|
b = encodeComma(b)
|
||||||
code = code.next
|
code = code.next
|
||||||
}
|
}
|
||||||
|
@ -3532,7 +3528,7 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
b = append(b, code.key...)
|
b = append(b, code.key...)
|
||||||
b = encodeEscapedString(b, *(*string)(unsafe.Pointer(&bytes)))
|
b = encodeNoEscapedString(b, *(*string)(unsafe.Pointer(&bytes)))
|
||||||
b = encodeComma(b)
|
b = encodeComma(b)
|
||||||
code = code.next
|
code = code.next
|
||||||
}
|
}
|
||||||
|
|
|
@ -4165,7 +4165,7 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
|
||||||
if err := compact(&buf, bb, e.enabledHTMLEscape); err != nil {
|
if err := compact(&buf, bb, e.enabledHTMLEscape); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
b = encodeEscapedString(b, buf.String())
|
b = encodeNoEscapedString(b, buf.String())
|
||||||
b = encodeIndentComma(b)
|
b = encodeIndentComma(b)
|
||||||
code = code.next
|
code = code.next
|
||||||
case opStructFieldStringTagMarshalText:
|
case opStructFieldStringTagMarshalText:
|
||||||
|
|
Loading…
Reference in New Issue