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:
Diffstat (limited to 'bufferpool')
-rw-r--r--bufferpool/bufpool.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/bufferpool/bufpool.go b/bufferpool/bufpool.go
index 0b7829b2c..5a550e0e7 100644
--- a/bufferpool/bufpool.go
+++ b/bufferpool/bufpool.go
@@ -24,10 +24,13 @@ var bufferPool = &sync.Pool{
},
}
+// GetBuffer returns a buffer from the pool.
func GetBuffer() (buf *bytes.Buffer) {
return bufferPool.Get().(*bytes.Buffer)
}
+// PutBuffer returns a buffer to the pool.
+// The buffer is reset before it is put back into circulation.
func PutBuffer(buf *bytes.Buffer) {
buf.Reset()
bufferPool.Put(buf)