You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-library/vendor/github.com/chenzhuoyu/iasm/expr/pools.go

27 lines
367 B

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
}