MCPcopy
hub / github.com/tinylib/msgp / resizeSlice

Method resizeSlice

gen/spec.go:465–467  ·  view source on GitHub ↗
(size string, s *Slice)

Source from the content-addressed store, hash-verified

463}
464
465func (p *printer) resizeSlice(size string, s *Slice) {
466 p.printf("\nif cap(%[1]s) >= int(%[2]s) { %[1]s = (%[1]s)[:%[2]s] } else { %[1]s = make(%[3]s, %[2]s) }", s.Varname(), size, s.TypeName())
467}
468
469// resizeSliceNoNil will resize a slice and will not allow nil slices.
470func (p *printer) resizeSliceNoNil(size string, s *Slice) {

Callers 2

gSliceMethod · 0.80
gSliceMethod · 0.80

Calls 3

printfMethod · 0.95
VarnameMethod · 0.65
TypeNameMethod · 0.65

Tested by

no test coverage detected