shithub: hugo

Download patch

ref: 4828fee11daf2c989aa40061ccf6ba7b7c685364
parent: 5441fc5dfc056a4e4dfd34ca16f0928e482b4c29
author: spf13 <[email protected]>
date: Fri Jan 30 06:39:06 EST 2015

transform chain using BBP

--- a/transform/chain.go
+++ b/transform/chain.go
@@ -1,8 +1,9 @@
 package transform
 
 import (
-	"bytes"
 	"io"
+
+	bp "github.com/spf13/hugo/bufferpool"
 )
 
 type trans func([]byte) []byte
@@ -20,8 +21,9 @@
 }
 
 func (c *chain) Apply(w io.Writer, r io.Reader) (err error) {
+	buffer := bp.GetBuffer()
+	defer bp.PutBuffer(buffer)
 
-	buffer := new(bytes.Buffer)
 	buffer.ReadFrom(r)
 	b := buffer.Bytes()
 	for _, tr := range *c {