Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-05-17 20:39:40 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-05-17 20:39:40 +0300
commita9bcd38181ceb79afba82adcd4de1aebf571e74c (patch)
treeaed7295326181f97bb1722818fb2ecec826232e2 /publisher
parentef0f1a726901d6c614040cfc2d7e8f9a2ca97816 (diff)
publisher: Get the collector in line with the io.Writer interface
As in: Do not retain the input slice.
Diffstat (limited to 'publisher')
-rw-r--r--publisher/htmlElementsCollector.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/publisher/htmlElementsCollector.go b/publisher/htmlElementsCollector.go
index 1bc1a09bc..e1c743eab 100644
--- a/publisher/htmlElementsCollector.go
+++ b/publisher/htmlElementsCollector.go
@@ -152,18 +152,21 @@ type htmlElementsCollectorWriter struct {
}
// Write collects HTML elements from p.
-func (w *htmlElementsCollectorWriter) Write(p []byte) (n int, err error) {
- n = len(p)
+func (w *htmlElementsCollectorWriter) Write(p []byte) (int, error) {
w.input = p
- w.pos = 0
for {
w.r = w.next()
if w.r == eof {
- return
+ break
}
w.state = w.state(w)
}
+
+ w.pos = 0
+ w.input = nil
+
+ return len(p), nil
}
func (l *htmlElementsCollectorWriter) backup() {