mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-12-14 19:26:43 +00:00
66b77acb1c
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
26 lines
367 B
Go
26 lines
367 B
Go
package expr
|
|
|
|
import (
|
|
`sync`
|
|
)
|
|
|
|
var (
|
|
expressionPool sync.Pool
|
|
)
|
|
|
|
func newExpression() *Expr {
|
|
if v := expressionPool.Get(); v == nil {
|
|
return new(Expr)
|
|
} else {
|
|
return resetExpression(v.(*Expr))
|
|
}
|
|
}
|
|
|
|
func freeExpression(p *Expr) {
|
|
expressionPool.Put(p)
|
|
}
|
|
|
|
func resetExpression(p *Expr) *Expr {
|
|
*p = Expr{}
|
|
return p
|
|
}
|