MCPcopy
hub / github.com/pquerna/ffjson / Grow

Method Grow

fflib/v1/buffer.go:165–171  ·  view source on GitHub ↗

Grow grows the buffer's capacity, if necessary, to guarantee space for another n bytes. After Grow(n), at least n bytes can be written to the buffer without another allocation. If n is negative, Grow will panic. If the buffer can't grow it will panic with ErrTooLarge.

(n int)

Source from the content-addressed store, hash-verified

163// If n is negative, Grow will panic.
164// If the buffer can't grow it will panic with ErrTooLarge.
165func (b *Buffer) Grow(n int) {
166 if n < 0 {
167 panic("bytes.Buffer.Grow: negative count")
168 }
169 m := b.grow(n)
170 b.buf = b.buf[0:m]
171}
172
173// Write appends the contents of p to the buffer, growing the buffer as
174// needed. The return value n is the length of p; err is always nil. If the

Callers

nothing calls this directly

Calls 1

growMethod · 0.95

Tested by

no test coverage detected