resetTail will reset tail node or add an empty tail node to guarantee the tail node is not larger than 8KB
(maxSize int)
| 738 | // resetTail will reset tail node or add an empty tail node to |
| 739 | // guarantee the tail node is not larger than 8KB |
| 740 | func (b *UnsafeLinkBuffer) resetTail(maxSize int) { |
| 741 | if maxSize <= pagesize { |
| 742 | // no need to reset a small buffer tail node |
| 743 | return |
| 744 | } |
| 745 | // set nil tail |
| 746 | b.write.next = newLinkBufferNode(0) |
| 747 | b.write = b.write.next |
| 748 | b.flush = b.write |
| 749 | } |
| 750 | |
| 751 | // indexByte returns the index of the first instance of c in buffer, or -1 if c is not present in buffer. |
| 752 | func (b *UnsafeLinkBuffer) indexByte(c byte, skip int) int { |