| 315 | } |
| 316 | |
| 317 | func (enc *encoder) setScalarVal(fj fastJsonNode, sv []byte) error { |
| 318 | offset, err := enc.arena.put(sv) |
| 319 | if err != nil { |
| 320 | return err |
| 321 | } |
| 322 | fj.meta |= uint64(offset) |
| 323 | |
| 324 | // Also increase curSize. |
| 325 | enc.curSize += uint64(len(sv)) |
| 326 | if size := uint64(enc.alloc.Size()) + enc.curSize; size > maxEncodedSize { |
| 327 | return fmt.Errorf("estimated response size: %d is bigger than threshold: %d", |
| 328 | size, maxEncodedSize) |
| 329 | } |
| 330 | return nil |
| 331 | } |
| 332 | |
| 333 | func (enc *encoder) setList(fj fastJsonNode, list bool) { |
| 334 | if list { |