MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / grow

Method grow

xmlparser/buffer.go:83–88  ·  view source on GitHub ↗

grow ensures that the buffer has at least n free bytes of capacity. It grows the buffer to the next power of two if necessary.

(n int)

Source from the content-addressed store, hash-verified

81// grow ensures that the buffer has at least n free bytes of capacity.
82// It grows the buffer to the next power of two if necessary.
83func (b *buffer) grow(n int) {
84 if req := len(*b) + n; req > cap(*b) {
85 p := math.Ceil(math.Log2(float64(req)))
86 *b = slices.Grow(*b, 1<<int(p))
87 }
88}
89
90// newBuffer creates a new buffer from the pool.
91func newBuffer() *buffer {

Callers 2

WriteMethod · 0.95
WriteByteMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected