aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/json-iterator/go/pool.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2019-10-23 23:03:17 -0700
committerGitHub <noreply@github.com>2019-10-23 23:03:17 -0700
commit613139e7bef81d3573e7988a47eb6765f3de347a (patch)
tree49de7277898d3ff47a122c072568edb8ed4c9ac9 /vendor/github.com/json-iterator/go/pool.go
parentfb100dbf98f02e4c631d142ff0f52ec29ee2f00c (diff)
Enable Go modules (#5835)
* Remove vendor * Enable Go modules * ci: add command to fetch dependencies * ci: update setting * ci: update settings * Require Go 1.11 * Rename module name to gogs.io/gogs
Diffstat (limited to 'vendor/github.com/json-iterator/go/pool.go')
-rw-r--r--vendor/github.com/json-iterator/go/pool.go42
1 files changed, 0 insertions, 42 deletions
diff --git a/vendor/github.com/json-iterator/go/pool.go b/vendor/github.com/json-iterator/go/pool.go
deleted file mode 100644
index e2389b56..00000000
--- a/vendor/github.com/json-iterator/go/pool.go
+++ /dev/null
@@ -1,42 +0,0 @@
-package jsoniter
-
-import (
- "io"
-)
-
-// IteratorPool a thread safe pool of iterators with same configuration
-type IteratorPool interface {
- BorrowIterator(data []byte) *Iterator
- ReturnIterator(iter *Iterator)
-}
-
-// StreamPool a thread safe pool of streams with same configuration
-type StreamPool interface {
- BorrowStream(writer io.Writer) *Stream
- ReturnStream(stream *Stream)
-}
-
-func (cfg *frozenConfig) BorrowStream(writer io.Writer) *Stream {
- stream := cfg.streamPool.Get().(*Stream)
- stream.Reset(writer)
- return stream
-}
-
-func (cfg *frozenConfig) ReturnStream(stream *Stream) {
- stream.out = nil
- stream.Error = nil
- stream.Attachment = nil
- cfg.streamPool.Put(stream)
-}
-
-func (cfg *frozenConfig) BorrowIterator(data []byte) *Iterator {
- iter := cfg.iteratorPool.Get().(*Iterator)
- iter.ResetBytes(data)
- return iter
-}
-
-func (cfg *frozenConfig) ReturnIterator(iter *Iterator) {
- iter.Error = nil
- iter.Attachment = nil
- cfg.iteratorPool.Put(iter)
-}