aboutsummaryrefslogtreecommitdiff
path: root/compress.go
diff options
context:
space:
mode:
authorGravatar Erik Dubbelboer <erik@dubbelboer.com> 2018-10-01 14:15:29 +0800
committerGravatar Erik Dubbelboer <erik@dubbelboer.com> 2018-10-01 14:15:29 +0800
commitd4f0cf56d8a7bb271fbd8634d78645bd3c24c9b7 (patch)
tree2bf17d8d3ff14938e770f57d2b95dc19407fca7c /compress.go
parentAdd tcp keepalive (diff)
downloadfasthttp-d4f0cf56d8a7bb271fbd8634d78645bd3c24c9b7.tar.gz
fasthttp-d4f0cf56d8a7bb271fbd8634d78645bd3c24c9b7.tar.bz2
fasthttp-d4f0cf56d8a7bb271fbd8634d78645bd3c24c9b7.zip
Remove fasthttp.ByteBuffer
As advertised in https://github.com/valyala/fasthttp/commit/b5f96d4b4120bb1e09c23ac32baf21a14da4a71d
Diffstat (limited to 'compress.go')
-rw-r--r--compress.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/compress.go b/compress.go
index 221472a..73a40d3 100644
--- a/compress.go
+++ b/compress.go
@@ -152,7 +152,6 @@ func WriteGzipLevel(w io.Writer, p []byte, level int) (int, error) {
switch w.(type) {
case *byteSliceWriter,
*bytes.Buffer,
- *ByteBuffer,
*bytebufferpool.ByteBuffer:
// These writers don't block, so we can just use stacklessWriteGzip
ctx := &compressCtx{
@@ -249,7 +248,6 @@ func WriteDeflateLevel(w io.Writer, p []byte, level int) (int, error) {
switch w.(type) {
case *byteSliceWriter,
*bytes.Buffer,
- *ByteBuffer,
*bytebufferpool.ByteBuffer:
// These writers don't block, so we can just use stacklessWriteDeflate
ctx := &compressCtx{
@@ -409,7 +407,7 @@ func isFileCompressible(f *os.File, minCompressRatio float64) bool {
// Try compressing the first 4kb of of the file
// and see if it can be compressed by more than
// the given minCompressRatio.
- b := AcquireByteBuffer()
+ b := bytebufferpool.Get()
zw := acquireStacklessGzipWriter(b, CompressDefaultCompression)
lr := &io.LimitedReader{
R: f,
@@ -424,7 +422,7 @@ func isFileCompressible(f *os.File, minCompressRatio float64) bool {
n := 4096 - lr.N
zn := len(b.B)
- ReleaseByteBuffer(b)
+ bytebufferpool.Put(b)
return float64(zn) < float64(n)*minCompressRatio
}