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)
| 128 | // returnBuffer returns the unused portion of buf to the Scanner, to be used for |
| 129 | // future allocBytes() or buffer() calls. The caller must not use buf again. |
| 130 | func (s *Scanner) returnBuffer(buf []byte) { |
| 131 | if len(buf) < cap(buf) { |
| 132 | s.bytesPrealloc = buf[len(buf):] |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | // finishString casts the given buffer to a string and returns the unused |
| 137 | // portion of the buffer. The caller must not use buf again. |