(length int)
| 12 | ) |
| 13 | |
| 14 | func ByteSliceGet(length int) (data []byte) { |
| 15 | select { |
| 16 | case data = <-byteSliceChan: |
| 17 | default: |
| 18 | data = byteSlicePool.Get().([]byte)[:0] |
| 19 | } |
| 20 | |
| 21 | if cap(data) < length { |
| 22 | data = make([]byte, length) |
| 23 | } else { |
| 24 | data = data[:length] |
| 25 | } |
| 26 | |
| 27 | return data |
| 28 | } |
| 29 | |
| 30 | func ByteSlicePut(data []byte) { |
| 31 | select { |
no test coverage detected