1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2024-12-24 00:37:28 +00:00
restic/crypto/buffer_pool.go
Alexander Neumann 3a2525809c Reorganize crypto code
Move all crypto functions to package "crypto", move random generators
for tests into helper package.
2015-04-12 09:36:14 +02:00

19 lines
267 B
Go

package crypto
import "sync"
const defaultBufSize = 2048
var bufPool = sync.Pool{
New: func() interface{} {
return make([]byte, defaultBufSize)
},
}
func getBuffer() []byte {
return bufPool.Get().([]byte)
}
func freeBuffer(buf []byte) {
bufPool.Put(buf)
}