diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-08-05 11:23:53 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-08-05 11:24:16 +0200 |
commit | 27110133ffca05feae2e11a9ff28a9a00f613350 (patch) | |
tree | 2a14de804d838d0de4e108b9ff411c442c9ec6b5 /transform/chain.go | |
parent | 31faf98ce32f895ef9fb68e12ec052f9b838cde4 (diff) |
transform: Simplify the 0 transformer case
Diffstat (limited to 'transform/chain.go')
-rw-r--r-- | transform/chain.go | 9 |
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) |