Module: sip-router
Branch: master
Commit: d6dd5f5649bd5b41c7535bde7230251802e88641
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d6dd5f5…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Thu Aug 26 21:44:59 2010 +0200
core: pointer aliasing warning fixes for fix_rval_expr
---
route.c | 18 +++++++++---------
rvalue.c | 21 +++++++++------------
rvalue.h | 2 +-
3 files changed, 19 insertions(+), 22 deletions(-)
diff --git a/route.c b/route.c
index f198193..45de184 100644
--- a/route.c
+++ b/route.c
@@ -549,7 +549,7 @@ int fix_expr(struct expr* exp)
to non-rvals, e.g. string, avp a.s.o and needs to be done
before MATCH_OP and other fixups) */
if (exp->l_type==RVEXP_O){
- if ((ret=fix_rval_expr(&exp->l.param))<0){
+ if ((ret=fix_rval_expr(exp->l.param))<0){
ERR("Unable to fix left rval expression\n");
return ret;
}
@@ -557,7 +557,7 @@ int fix_expr(struct expr* exp)
exp_optimize_left(exp);
}
if (exp->r_type==RVE_ST){
- if ((ret=fix_rval_expr(&exp->r.param))<0){
+ if ((ret=fix_rval_expr(exp->r.param))<0){
ERR("Unable to fix right rval expression\n");
return ret;
}
@@ -747,7 +747,7 @@ int fix_actions(struct action* a)
return E_UNSPEC;
}
*/
- if ((ret=fix_rval_expr(&t->val[0].u.data))<0)
+ if ((ret=fix_rval_expr(t->val[0].u.data))<0)
goto error;
}
if ( (t->val[1].type==ACTIONS_ST)&&(t->val[1].u.data) ){
@@ -775,7 +775,7 @@ int fix_actions(struct action* a)
goto error;
}
if (t->val[0].u.data){
- if ((ret=fix_rval_expr(&t->val[0].u.data))<0)
+ if ((ret=fix_rval_expr(t->val[0].u.data))<0)
goto error;
}else{
LOG(L_CRIT, "BUG: fix_actions: null switch()"
@@ -827,7 +827,7 @@ int fix_actions(struct action* a)
ret = E_SCRIPT;
goto error;
}
- if ((ret=fix_rval_expr(&t->val[0].u.data))<0)
+ if ((ret=fix_rval_expr(t->val[0].u.data))<0)
goto error;
}else{
LOG(L_CRIT, "BUG: fix_actions: null while()"
@@ -871,7 +871,7 @@ int fix_actions(struct action* a)
ret = E_SCRIPT;
goto error;
}
- if ((ret=fix_rval_expr(&t->val[0].u.data))<0)
+ if ((ret=fix_rval_expr(t->val[0].u.data))<0)
goto error;
}else{
LOG(L_CRIT, "BUG: fix_actions: null drop/return"
@@ -910,7 +910,7 @@ int fix_actions(struct action* a)
goto error;
}
}
- if ((ret=fix_rval_expr(&t->val[1].u.data))<0)
+ if ((ret=fix_rval_expr(t->val[1].u.data))<0)
goto error;
break;
@@ -963,7 +963,7 @@ int fix_actions(struct action* a)
/* expression is not constant => fixup &
optimize it */
rve_param_no++;
- if ((ret=fix_rval_expr(&t->val[i+2].u.data))
+ if ((ret=fix_rval_expr(t->val[i+2].u.data))
< 0) {
ERR("rve fixup failed\n");
ret = E_BUG;
@@ -1104,7 +1104,7 @@ int fix_actions(struct action* a)
if (t->val[0].type == RVE_ST) {
rve=(struct rval_expr*)t->val[0].u.data;
if (!rve_is_constant(rve)) {
- if ((ret=fix_rval_expr(&t->val[0].u.data)) < 0){
+ if ((ret=fix_rval_expr(t->val[0].u.data)) < 0){
ERR("route() failed to fix rve at %s:%d\n",
(t->cfile)?t->cfile:"line", t->cline);
ret = E_BUG;
diff --git a/rvalue.c b/rvalue.c
index 707a7f4..eeac3d5 100644
--- a/rvalue.c
+++ b/rvalue.c
@@ -2899,7 +2899,7 @@ static int fix_match_rve(struct rval_expr* rve)
v.s.s=0;
v.re.regex=0;
/* normal fix-up for the left side */
- ret=fix_rval_expr((void**)&rve->left.rve);
+ ret=fix_rval_expr((void*)rve->left.rve);
if (ret<0) return ret;
/* fixup the right side (RE) */
@@ -2946,7 +2946,7 @@ static int fix_match_rve(struct rval_expr* rve)
goto error;
}else{
/* right side is not constant => normal fixup */
- return fix_rval_expr((void**)&rve->right.rve);
+ return fix_rval_expr((void*)rve->right.rve);
}
return 0;
error:
@@ -3688,19 +3688,16 @@ error:
/** fix a rval_expr.
* fixes action, bexprs, resolves selects, pvars and
* optimizes simple sub expressions (e.g. 1+2).
- * It might modify *p.
*
- * @param p - double pointer to a rval_expr (might be changed to a new one)
- * @return 0 on success, <0 on error (modifies also *p)
+ * @param p - pointer to a rval_expr
+ * @return 0 on success, <0 on error (modifies also *(struct rval_expr*)p)
*/
-int fix_rval_expr(void** p)
+int fix_rval_expr(void* p)
{
- struct rval_expr** prve;
struct rval_expr* rve;
int ret;
- prve=(struct rval_expr**)p;
- rve=*prve;
+ rve=(struct rval_expr*)p;
switch(rve->op){
case RVE_NONE_OP:
@@ -3716,7 +3713,7 @@ int fix_rval_expr(void** p)
case RVE_DEFINED_OP:
case RVE_INT_OP:
case RVE_STR_OP:
- ret=fix_rval_expr((void**)&rve->left.rve);
+ ret=fix_rval_expr((void*)rve->left.rve);
if (ret<0) return ret;
break;
case RVE_MUL_OP:
@@ -3740,9 +3737,9 @@ int fix_rval_expr(void** p)
case RVE_STREQ_OP:
case RVE_STRDIFF_OP:
case RVE_CONCAT_OP:
- ret=fix_rval_expr((void**)&rve->left.rve);
+ ret=fix_rval_expr((void*)rve->left.rve);
if (ret<0) return ret;
- ret=fix_rval_expr((void**)&rve->right.rve);
+ ret=fix_rval_expr((void*)rve->right.rve);
if (ret<0) return ret;
break;
case RVE_MATCH_OP:
diff --git a/rvalue.h b/rvalue.h
index 90c02b3..8e67c2e 100644
--- a/rvalue.h
+++ b/rvalue.h
@@ -240,5 +240,5 @@ struct rval_expr* mk_rval_expr2(enum rval_expr_op op, struct
rval_expr* rve1,
void rve_destroy(struct rval_expr* rve);
/** fix a rval_expr. */
-int fix_rval_expr(void** p);
+int fix_rval_expr(void* p);
#endif /* _rvalue_h */