vendor: update all dependencies to latest versions

This commit is contained in:
Nick Craig-Wood 2018-01-16 13:20:59 +00:00
parent 8e83fb6fb9
commit 7d3a17725d
4878 changed files with 1974229 additions and 201215 deletions

View file

@ -0,0 +1,39 @@
package buffer
import "sync"
// A BytesBufferPool is a type-safe wrapper around a sync.BytesBufferPool.
type BytesBufferPool struct {
p *sync.Pool
}
// NewBytesPool constructs a new BytesBufferPool.
func NewBytesPool() BytesBufferPool {
return BytesBufferPool{
p: &sync.Pool{
New: func() interface{} {
return &BytesBuffer{bs: make([]byte, 0, defaultSize)}
},
},
}
}
// Get retrieves a BytesBuffer from the pool, creating one if necessary.
func (p BytesBufferPool) Get() *BytesBuffer {
buf := p.p.Get().(*BytesBuffer)
buf.Reset()
buf.pool = p
return buf
}
func (p BytesBufferPool) put(buf *BytesBuffer) {
p.p.Put(buf)
}
// GlobalBytesPool returns the global buffer pool.
func GlobalBytesPool() *BytesBufferPool {
return &bytesPool
}
// bytesPool is a pool of buffer bytes.
var bytesPool = NewBytesPool()