[sr-dev] git:master: core: apply all subst pre-processor directives

Daniel-Constantin Mierla miconda at gmail.com
Fri Oct 15 11:20:30 CEST 2010


Module: sip-router
Branch: master
Commit: a423e3141332f40fec07da1efe9f5e227fff0061
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a423e3141332f40fec07da1efe9f5e227fff0061

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Fri Oct 15 11:19:18 2010 +0200

core: apply all subst pre-processor directives

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

---

 ppcfg.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/ppcfg.c b/ppcfg.c
index 8830f71..30754d4 100644
--- a/ppcfg.c
+++ b/ppcfg.c
@@ -83,6 +83,7 @@ int pp_subst_run(char **data)
 {
 	str* result;
 	pp_subst_rule_t *pr;
+	int i;
 
 	if(pp_subst_rules_head==NULL)
 		return 0;
@@ -93,22 +94,25 @@ int pp_subst_run(char **data)
 		return 0;
 	pr = pp_subst_rules_head;
 
+	i = 0;
 	while(pr)
 	{
 		result=subst_str(*data, 0,
 				(struct subst_expr*)pr->ppdata, 0); /* pkg malloc'ed result */
 		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);
 			*data = result->s;
 			pkg_free(result);
-			return 1;
 		}
 		pr = pr->next;
 	}
 
+	if(i!=0)
+		return 1;
 	return 0;
 }
 




More information about the sr-dev mailing list