ensure 'sz' extra bytes in 'b' btw len(b) and cap(b)
(b []byte, sz int)
| 11 | |
| 12 | // ensure 'sz' extra bytes in 'b' btw len(b) and cap(b) |
| 13 | func ensure(b []byte, sz int) ([]byte, int) { |
| 14 | l := len(b) |
| 15 | c := cap(b) |
| 16 | if c-l < sz { |
| 17 | o := make([]byte, (2*c)+sz) // exponential growth |
| 18 | n := copy(o, b) |
| 19 | return o[:n+sz], n |
| 20 | } |
| 21 | return b[:l+sz], l |
| 22 | } |
| 23 | |
| 24 | // AppendMapHeader appends a map header with the |
| 25 | // given size to the slice |
no outgoing calls
no test coverage detected
searching dependent graphs…