returnBuffer returns the unused portion of buf to the scanner, to be used for future allocBytes() or buffer() calls. The caller must not use buf again.
(buf []byte)
| 76 | // returnBuffer returns the unused portion of buf to the scanner, to be used for |
| 77 | // future allocBytes() or buffer() calls. The caller must not use buf again. |
| 78 | func (s *scanner) returnBuffer(buf []byte) { |
| 79 | if len(buf) < cap(buf) { |
| 80 | s.bytesPrealloc = buf[len(buf):] |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | // finishString casts the given buffer to a string and returns the unused |
| 85 | // portion of the buffer. The caller must not use buf again. |