Skip to content

Commit

Permalink
smt: allocate subst vars array on the stack, as it is always very small
Browse files Browse the repository at this point in the history
  • Loading branch information
nunoplopes committed Dec 16, 2024
1 parent 84196ac commit 92736c4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions smt/expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2220,13 +2220,13 @@ expr expr::subst(const vector<expr> &repls) const {
if (repls.empty())
return *this;

unique_ptr<Z3_ast[]> vars(new Z3_ast[repls.size()]);
Z3_ast vars[repls.size()];
unsigned i = 0;
for (auto &v : repls) {
C2(v);
vars[i++] = v();
}
return Z3_substitute_vars(ctx(), ast(), repls.size(), vars.get());
return Z3_substitute_vars(ctx(), ast(), repls.size(), vars);
}

set<expr> expr::vars() const {
Expand Down

0 comments on commit 92736c4

Please sign in to comment.