Fix decoder

This commit is contained in:
Masaaki Goshima 2020-04-26 15:22:55 +09:00
parent 77059977ce
commit 9b1349d40a
4 changed files with 6 additions and 3 deletions

View File

@ -200,7 +200,6 @@ func Benchmark_Decode_LargeStruct_GoJayUnsafe(b *testing.B) {
}
}
/*
func Benchmark_Decode_LargeStruct_GoJson(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
@ -220,4 +219,3 @@ func Benchmark_Decode_LargeStruct_GoJsonNoEscape(b *testing.B) {
}
}
}
*/

View File

@ -38,6 +38,7 @@ func (d *arrayDecoder) decode(ctx *context, p uintptr) error {
cursor = ctx.skipWhiteSpace()
switch buf[cursor] {
case ']':
ctx.cursor++
return nil
case ',':
idx++

View File

@ -58,6 +58,7 @@ func (d *sliceDecoder) decode(ctx *context, p uintptr) error {
Len: idx + 1,
Cap: cap,
}
ctx.cursor++
return nil
case ',':
idx++

View File

@ -57,7 +57,10 @@ func (d *structDecoder) skipValue(ctx *context) error {
continue
}
if tk == '"' {
cursor++
if bracketCount == 0 && braceCount == 0 {
ctx.cursor = cursor + 1
return nil
}
break
}
}