mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
transform: Simplify the 0 transformer case
This commit is contained in:
parent
31faf98ce3
commit
27110133ff
1 changed files with 4 additions and 5 deletions
|
@ -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)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue