writeInt is equivalent to fmt.Fprint with an int64 argument but uses strconv.AppendInt with a byte slice taken from a sync.Pool to avoid allocations.
(w enhancedWriter, i int64)
| 500 | // strconv.AppendInt with a byte slice taken from a sync.Pool to avoid |
| 501 | // allocations. |
| 502 | func writeInt(w enhancedWriter, i int64) (int, error) { |
| 503 | bp := numBufPool.Get().(*[]byte) |
| 504 | *bp = strconv.AppendInt((*bp)[:0], i, 10) |
| 505 | written, err := w.Write(*bp) |
| 506 | numBufPool.Put(bp) |
| 507 | return written, err |
| 508 | } |
| 509 | |
| 510 | // writeName writes a string as-is if it complies with the legacy naming |
| 511 | // scheme, or escapes it in double quotes if not. |
no test coverage detected
searching dependent graphs…