Browse code

core: apply all subst pre-processor directives

- previously first applied subst stopped the processes
- reported by Alex Balashov

Daniel-Constantin Mierla authored on 15/10/2010 09:19:18
Showing 1 changed files
... ...
@@ -83,6 +83,7 @@ int pp_subst_run(char **data)
83 83
 {
84 84
 	str* result;
85 85
 	pp_subst_rule_t *pr;
86
+	int i;
86 87
 
87 88
 	if(pp_subst_rules_head==NULL)
88 89
 		return 0;
... ...
@@ -93,22 +94,25 @@ int pp_subst_run(char **data)
93 94
 		return 0;
94 95
 	pr = pp_subst_rules_head;
95 96
 
97
+	i = 0;
96 98
 	while(pr)
97 99
 	{
98 100
 		result=subst_str(*data, 0,
99 101
 				(struct subst_expr*)pr->ppdata, 0); /* pkg malloc'ed result */
100 102
 		if(result!=NULL)
101 103
 		{
102
-			LM_DBG("### preprocess subst applied to [%s]"
103
-					" - returning new string [%s]\n", *data, result->s);
104
+			i++;
105
+			LM_DBG("preprocess subst applied [#%d] to [%s]"
106
+					" - returning new string [%s]\n", i, *data, result->s);
104 107
 			pkg_free(*data);
105 108
 			*data = result->s;
106 109
 			pkg_free(result);
107
-			return 1;
108 110
 		}
109 111
 		pr = pr->next;
110 112
 	}
111 113
 
114
+	if(i!=0)
115
+		return 1;
112 116
 	return 0;
113 117
 }
114 118