MCPcopy Index your code
hub / github.com/vmihailenco/msgpack / decodeStringSlicePtr

Method decodeStringSlicePtr

decode_slice.go:43–63  ·  view source on GitHub ↗
(ptr *[]string)

Source from the content-addressed store, hash-verified

41}
42
43func (d *Decoder) decodeStringSlicePtr(ptr *[]string) error {
44 n, err := d.DecodeArrayLen()
45 if err != nil {
46 return err
47 }
48 if n == -1 {
49 return nil
50 }
51
52 ss := makeStrings(*ptr, n, d.flags&disableAllocLimitFlag != 0)
53 for i := 0; i < n; i++ {
54 s, err := d.DecodeString()
55 if err != nil {
56 return err
57 }
58 ss = append(ss, s)
59 }
60 *ptr = ss
61
62 return nil
63}
64
65func makeStrings(s []string, n int, noLimit bool) []string {
66 if !noLimit && n > sliceAllocLimit {

Callers 2

DecodeMethod · 0.95
decodeStringSliceValueFunction · 0.80

Calls 3

DecodeArrayLenMethod · 0.95
DecodeStringMethod · 0.95
makeStringsFunction · 0.85

Tested by

no test coverage detected