mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-05-20 09:18:13 +00:00
fe39d50e09
Bumps codeberg.org/gruf/go-store/v2 from 2.0.9 to 2.0.10. --- updated-dependencies: - dependency-name: codeberg.org/gruf/go-store/v2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
27 lines
565 B
Go
27 lines
565 B
Go
package util
|
|
|
|
import (
|
|
"sync"
|
|
|
|
"codeberg.org/gruf/go-fastpath/v2"
|
|
)
|
|
|
|
// pathBuilderPool is the global fastpath.Builder pool.
|
|
var pathBuilderPool = sync.Pool{
|
|
New: func() any {
|
|
return &fastpath.Builder{B: make([]byte, 0, 512)}
|
|
},
|
|
}
|
|
|
|
// GetPathBuilder fetches a fastpath.Builder object from the pool.
|
|
func GetPathBuilder() *fastpath.Builder {
|
|
pb, _ := pathBuilderPool.Get().(*fastpath.Builder)
|
|
return pb
|
|
}
|
|
|
|
// PutPathBuilder places supplied fastpath.Builder back in the pool.
|
|
func PutPathBuilder(pb *fastpath.Builder) {
|
|
pb.Reset()
|
|
pathBuilderPool.Put(pb)
|
|
}
|