MCPcopy Index your code
hub / github.com/cortexproject/cortex / copyStringToBuffer

Function copyStringToBuffer

pkg/cortexpb/compat.go:99–107  ·  view source on GitHub ↗

Copies string to buffer (which must be big enough), and converts buffer slice containing the string copy into new string.

(in string, buf []byte)

Source from the content-addressed store, hash-verified

97// Copies string to buffer (which must be big enough), and converts buffer slice containing
98// the string copy into new string.
99func copyStringToBuffer(in string, buf []byte) (string, []byte) {
100 l := len(in)
101 c := copy(buf, in)
102 if c != l {
103 panic("not copied full string")
104 }
105
106 return yoloString(buf[0:l]), buf[l:]
107}
108
109// FromLabelsToLabelAdapters casts labels.Labels to []LabelAdapter.
110// It uses unsafe, but as LabelAdapter == labels.Label this should be safe.

Callers 1

CopyLabelsFunction · 0.85

Calls 1

yoloStringFunction · 0.70

Tested by

no test coverage detected