forked from mirror/brotli
Reduce allocations of buffer for reused readers
This commit is contained in:
parent
729edfbcfe
commit
87d8f4575c
|
@ -33,6 +33,9 @@ func NewReader(src io.Reader) *Reader {
|
||||||
func (r *Reader) Reset(src io.Reader) error {
|
func (r *Reader) Reset(src io.Reader) error {
|
||||||
decoderStateInit(r)
|
decoderStateInit(r)
|
||||||
r.src = src
|
r.src = src
|
||||||
|
if r.buf != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
r.buf = make([]byte, readBufSize)
|
r.buf = make([]byte, readBufSize)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue