ref: 27110133ffca05feae2e11a9ff28a9a00f613350
parent: 31faf98ce32f895ef9fb68e12ec052f9b838cde4
author: Bjørn Erik Pedersen <[email protected]>
date: Sun Aug 5 07:23:53 EDT 2018
transform: Simplify the 0 transformer case
--- a/transform/chain.go
+++ b/transform/chain.go
@@ -65,16 +65,15 @@
}
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)
if _, err := b1.ReadFrom(r); err != nil {
- return err
- }
-
- if len(*c) == 0 {
- _, err := b1.WriteTo(w)
return err
}