(count int)
| 41 | } |
| 42 | |
| 43 | func (b *LimitBuffer) Malloc(count int) (result LimitBuffer) { |
| 44 | l := b.Len() |
| 45 | newL := l + count |
| 46 | if c := b.Cap(); newL > c { |
| 47 | panic(fmt.Sprintf("LimitBuffer Malloc %d > %d", newL, c)) |
| 48 | } else { |
| 49 | *b = b.SubBuf(0, newL) |
| 50 | } |
| 51 | return b.SubBuf(l, count) |
| 52 | } |
| 53 | |
| 54 | func (b *LimitBuffer) Write(a []byte) (n int, err error) { |
| 55 | l := b.Len() |