mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-10 19:54:08 +02:00
transform: Simplify the 0 transformer case
This commit is contained in:
@@ -65,6 +65,10 @@ func (ft fromToBuffer) Content() []byte {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *chain) Apply(w io.Writer, r io.Reader, p []byte) error {
|
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()
|
b1 := bp.GetBuffer()
|
||||||
defer bp.PutBuffer(b1)
|
defer bp.PutBuffer(b1)
|
||||||
@@ -73,11 +77,6 @@ func (c *chain) Apply(w io.Writer, r io.Reader, p []byte) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(*c) == 0 {
|
|
||||||
_, err := b1.WriteTo(w)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
b2 := bp.GetBuffer()
|
b2 := bp.GetBuffer()
|
||||||
defer bp.PutBuffer(b2)
|
defer bp.PutBuffer(b2)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user