浏览代码

core: apply all subst pre-processor directives

- previously first applied subst stopped the processes
- reported by Alex Balashov
Daniel-Constantin Mierla 15 年之前
父节点
当前提交
a423e31413
共有 1 个文件被更改,包括 7 次插入3 次删除
  1. 7 3
      ppcfg.c

+ 7 - 3
ppcfg.c

@@ -83,6 +83,7 @@ int pp_subst_run(char **data)
 {
 {
 	str* result;
 	str* result;
 	pp_subst_rule_t *pr;
 	pp_subst_rule_t *pr;
+	int i;
 
 
 	if(pp_subst_rules_head==NULL)
 	if(pp_subst_rules_head==NULL)
 		return 0;
 		return 0;
@@ -93,22 +94,25 @@ int pp_subst_run(char **data)
 		return 0;
 		return 0;
 	pr = pp_subst_rules_head;
 	pr = pp_subst_rules_head;
 
 
+	i = 0;
 	while(pr)
 	while(pr)
 	{
 	{
 		result=subst_str(*data, 0,
 		result=subst_str(*data, 0,
 				(struct subst_expr*)pr->ppdata, 0); /* pkg malloc'ed result */
 				(struct subst_expr*)pr->ppdata, 0); /* pkg malloc'ed result */
 		if(result!=NULL)
 		if(result!=NULL)
 		{
 		{
-			LM_DBG("### preprocess subst applied to [%s]"
-					" - returning new string [%s]\n", *data, result->s);
+			i++;
+			LM_DBG("preprocess subst applied [#%d] to [%s]"
+					" - returning new string [%s]\n", i, *data, result->s);
 			pkg_free(*data);
 			pkg_free(*data);
 			*data = result->s;
 			*data = result->s;
 			pkg_free(result);
 			pkg_free(result);
-			return 1;
 		}
 		}
 		pr = pr->next;
 		pr = pr->next;
 	}
 	}
 
 
+	if(i!=0)
+		return 1;
 	return 0;
 	return 0;
 }
 }