summaryrefslogtreecommitdiffhomepage
path: root/transform
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2018-08-05 11:23:53 +0200
committerBjørn Erik Pedersen <[email protected]>2018-08-05 11:24:16 +0200
commit27110133ffca05feae2e11a9ff28a9a00f613350 (patch)
tree2a14de804d838d0de4e108b9ff411c442c9ec6b5 /transform
parent31faf98ce32f895ef9fb68e12ec052f9b838cde4 (diff)
downloadhugo-27110133ffca05feae2e11a9ff28a9a00f613350.tar.gz
hugo-27110133ffca05feae2e11a9ff28a9a00f613350.zip
transform: Simplify the 0 transformer case
Diffstat (limited to 'transform')
-rw-r--r--transform/chain.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/transform/chain.go b/transform/chain.go
index f9c99a04a..f71de94c8 100644
--- a/transform/chain.go
+++ b/transform/chain.go
@@ -65,6 +65,10 @@ func (ft fromToBuffer) Content() []byte {
}
func (c *chain) Apply(w io.Writer, r io.Reader, p []byte) error {
+ if len(*c) == 0 {
+ _, err := io.Copy(w, r)
+ return err
+ }
b1 := bp.GetBuffer()
defer bp.PutBuffer(b1)
@@ -73,11 +77,6 @@ func (c *chain) Apply(w io.Writer, r io.Reader, p []byte) error {
return err
}
- if len(*c) == 0 {
- _, err := b1.WriteTo(w)
- return err
- }
-
b2 := bp.GetBuffer()
defer bp.PutBuffer(b2)