MCPcopy Index your code
hub / github.com/godbus/dbus / read2buf

Method read2buf

decoder.go:89–98  ·  view source on GitHub ↗

read2buf reads exactly n bytes from the reader dec.in into the buffer dec.buf to reduce memory allocs. The buffer grows automatically.

(n int)

Source from the content-addressed store, hash-verified

87// to reduce memory allocs.
88// The buffer grows automatically.
89func (dec *decoder) read2buf(n int) {
90 if cap(dec.buf) < n {
91 dec.buf = make([]byte, n)
92 } else {
93 dec.buf = dec.buf[:n]
94 }
95 if _, err := io.ReadFull(dec.in, dec.buf); err != nil {
96 panic(err)
97 }
98}
99
100// decodeU decodes uint32 obtained from the reader dec.in.
101// The goal is to reduce memory allocs.

Callers 3

alignMethod · 0.95
decodeUMethod · 0.95
decodeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected