MCPcopy Index your code
hub / github.com/Monibuca/engine / Malloc

Method Malloc

util/buffer.go:195–206  ·  view source on GitHub ↗

Malloc 扩大原来的buffer的长度,返回新增的buffer

(count int)

Source from the content-addressed store, hash-verified

193
194// Malloc 扩大原来的buffer的长度,返回新增的buffer
195func (b *Buffer) Malloc(count int) Buffer {
196 l := b.Len()
197 newL := l + count
198 if newL > b.Cap() {
199 n := make(Buffer, newL)
200 copy(n, *b)
201 *b = n
202 } else {
203 *b = b.SubBuf(0, newL)
204 }
205 return b.SubBuf(l, count)
206}
207
208// Relloc 改变 buffer 到指定大小
209func (b *Buffer) Relloc(count int) {

Callers 6

WriteFloat64Method · 0.95
WriteUint32Method · 0.95
WriteUint24Method · 0.95
WriteUint16Method · 0.95
WriteByteMethod · 0.95
RellocMethod · 0.95

Calls 3

LenMethod · 0.95
CapMethod · 0.95
SubBufMethod · 0.95

Tested by

no test coverage detected