1
0
mirror of https://github.com/json-iterator/go.git synced 2024-11-27 08:30:57 +02:00

Merge pull request #368 from alextomaili/fix-memory-allocation-overhead

allocate string for error description only if it really required
This commit is contained in:
Tao Wen 2019-06-22 00:11:00 +08:00 committed by GitHub
commit 94869abf43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -530,8 +530,8 @@ func (decoder *generalStructDecoder) decodeOneField(ptr unsafe.Pointer, iter *It
}
}
if fieldDecoder == nil {
msg := "found unknown field: " + field
if decoder.disallowUnknownFields {
msg := "found unknown field: " + field
iter.ReportError("ReadObject", msg)
}
c := iter.nextToken()