Переглянути джерело

core: print cfg line and column inside fix_rval() if resolve select fails

Daniel-Constantin Mierla 8 роки тому
батько
коміт
d89d643ab1
1 змінених файлів з 11 додано та 6 видалено
  1. 11 6
      src/core/rvalue.c

+ 11 - 6
src/core/rvalue.c

@@ -2839,7 +2839,7 @@ static int rve_can_optimize_str(struct rval_expr* rve)
 		return 0;
 	if (rve->op == RVE_RVAL_OP)
 		return 0;
-	LM_DBG("left %d, right %d\n", 
+	LM_DBG("left %d, right %d\n",
 			rve->left.rve->op, rve->right.rve?rve->right.rve->op:0);
 	if (rve->left.rve->op != RVE_RVAL_OP)
 		return 0;
@@ -2848,7 +2848,7 @@ static int rve_can_optimize_str(struct rval_expr* rve)
 	if (rve->right.rve){
 		if  (rve->right.rve->op != RVE_RVAL_OP)
 			return 0;
-		if ((rve->right.rve->left.rval.type!=RV_STR) && 
+		if ((rve->right.rve->left.rval.type!=RV_STR) &&
 				(rve->right.rve->left.rval.type!=RV_INT))
 			return 0;
 	}
@@ -2858,7 +2858,7 @@ static int rve_can_optimize_str(struct rval_expr* rve)
 
 
 
-static int fix_rval(struct rvalue* rv)
+static int fix_rval(struct rvalue* rv, struct rval_expr* rve)
 {
 	LM_DBG("RV fixing type %d\n", rv->type);
 	switch(rv->type){
@@ -2876,8 +2876,13 @@ static int fix_rval(struct rvalue* rv)
 			return fix_actions(rv->v.action);
 		case RV_SEL:
 			if (resolve_select(&rv->v.sel)<0){
-				ERR("Unable to resolve select\n");
-				print_select(&rv->v.sel);
+				if(rve==NULL) {
+					ERR("Unable to resolve select\n");
+				} else {
+					ERR("Unable to resolve select in cfg at line: %d col: %d\n",
+							rve->fpos.s_line, rve->fpos.s_col);
+				}
+				err_select(&rv->v.sel);
 			}
 			return 0;
 		case RV_AVP:
@@ -3794,7 +3799,7 @@ int fix_rval_expr(void* p)
 			BUG("empty rval expr\n");
 			break;
 		case RVE_RVAL_OP:
-			ret = fix_rval(&rve->left.rval);
+			ret = fix_rval(&rve->left.rval, rve);
 			if (ret<0) goto error;
 			return ret;
 		case RVE_UMINUS_OP: /* unary operators */