MCPcopy Create free account
hub / github.com/Monibuca/engine / Malloc

Method Malloc

util/buffer.go:43–52  ·  view source on GitHub ↗
(count int)

Source from the content-addressed store, hash-verified

41}
42
43func (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
54func (b *LimitBuffer) Write(a []byte) (n int, err error) {
55 l := b.Len()

Callers

nothing calls this directly

Calls 3

SubBufMethod · 0.95
LenMethod · 0.65
CapMethod · 0.65

Tested by

no test coverage detected