Module: sip-router Branch: master Commit: c1111cb2ca9f5782c06158c8d57884ef65dfef38 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c1111cb2...
Author: Andrei Pelinescu-Onciul andrei@iptel.org Committer: Andrei Pelinescu-Onciul andrei@iptel.org Date: Mon May 4 22:23:59 2009 +0200
core expr. eval: fix fixup/optimization bug
In some cases some ref'ed rvals were replaced in-place, messing up the refcnt.
---
rvalue.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/rvalue.c b/rvalue.c index 976945a..c332173 100644 --- a/rvalue.c +++ b/rvalue.c @@ -3002,7 +3002,7 @@ static int rve_optimize(struct rval_expr* rve) if (rve->op == RVE_RVAL_OP) /* if rval, nothing to do */ return 0; if (rve_is_constant(rve)){ - if ((rv=rval_expr_eval(0, 0, rve))==0){ + if ((rv=rval_expr_eval_new(0, 0, rve))==0){ ERR("optimization failure, bad expression\n"); goto error; } @@ -3035,7 +3035,7 @@ static int rve_optimize(struct rval_expr* rve) } /* $v - a => $v + (-a) (easier to optimize)*/ if ((rve->op==RVE_MINUS_OP) && (rve_is_constant(rve->right.rve))){ - if ((rv=rval_expr_eval(0, 0, rve->right.rve))==0){ + if ((rv=rval_expr_eval_new(0, 0, rve->right.rve))==0){ ERR("optimization failure, bad expression\n"); goto error; } @@ -3114,7 +3114,7 @@ static int rve_optimize(struct rval_expr* rve) " +(+($v, a), b) when typeof(a)==INT\n"); return 0; } - if ((rv=rval_expr_eval(0, 0, &tmp_rve))==0){ + if ((rv=rval_expr_eval_new(0, 0, &tmp_rve))==0){ ERR("optimization failure, bad expression\n"); goto error; } @@ -3146,7 +3146,7 @@ static int rve_optimize(struct rval_expr* rve) cases are caught by rve_op_is_commutative() (in this case type will be typeof(a)) => ok only if typeof(a) is int) */ - if ((rv=rval_expr_eval(0, 0, &tmp_rve))==0){ + if ((rv=rval_expr_eval_new(0, 0, &tmp_rve))==0){ ERR("optimization failure, bad expression\n"); goto error; } @@ -3188,7 +3188,7 @@ static int rve_optimize(struct rval_expr* rve) cases are caught by rve_op_is_commutative() (in this case type will be typeof(a)) => ok only if typeof(a) is int) */ - if ((rv=rval_expr_eval(0, 0, &tmp_rve))==0){ + if ((rv=rval_expr_eval_new(0, 0, &tmp_rve))==0){ ERR("optimization failure, bad expression\n"); goto error; } @@ -3224,7 +3224,7 @@ static int rve_optimize(struct rval_expr* rve) " +(a, +(b, $v)) when typeof(a)!=typeof(b)\n"); return 0; } - if ((rv=rval_expr_eval(0, 0, &tmp_rve))==0){ + if ((rv=rval_expr_eval_new(0, 0, &tmp_rve))==0){ ERR("optimization failure, bad expression\n"); goto error; }