[sr-dev] git:master:0d33ab80: pv: use core helper function inside pv_evalx()

Daniel-Constantin Mierla miconda at gmail.com
Mon May 2 09:10:36 CEST 2016


Module: kamailio
Branch: master
Commit: 0d33ab80491a57799c0664c531ee6e534c9e938c
URL: https://github.com/kamailio/kamailio/commit/0d33ab80491a57799c0664c531ee6e534c9e938c

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-05-02T09:09:36+02:00

pv: use core helper function inside pv_evalx()

---

Modified: modules/pv/pv.c

---

Diff:  https://github.com/kamailio/kamailio/commit/0d33ab80491a57799c0664c531ee6e534c9e938c.diff
Patch: https://github.com/kamailio/kamailio/commit/0d33ab80491a57799c0664c531ee6e534c9e938c.patch

---

diff --git a/modules/pv/pv.c b/modules/pv/pv.c
index 4862a7d..1aa53ed 100644
--- a/modules/pv/pv.c
+++ b/modules/pv/pv.c
@@ -835,7 +835,6 @@ int w_pv_evalx(struct sip_msg *msg, char *dst, str *fmt)
 {
 	pv_spec_t *ispec=NULL;
 	pv_elem_t *imodel=NULL;
-	pv_elem_t *xmodel=NULL;
 	str tstr = {0, 0};
 	pv_value_t val;
 
@@ -850,24 +849,16 @@ int w_pv_evalx(struct sip_msg *msg, char *dst, str *fmt)
 		goto error;
 	}
 
-	if(pv_parse_format(&tstr, &xmodel)<0) {
-		LM_ERR("error in parsing evaluated second parameter\n");
-		return -1;
-	}
-
-	if(pv_printf_s(msg, xmodel, &val.rs)!=0) {
+	if(pv_eval_str(msg, &val.rs, &tstr)<0){
 		LM_ERR("cannot eval reparsed value of second parameter\n");
-		pv_elem_free_all(xmodel);
-		goto error;
+		return -1;
 	}
 
 	val.flags = PV_VAL_STR;
 	if(ispec->setf(msg, &ispec->pvp, EQ_T, &val)<0) {
 		LM_ERR("setting PV failed\n");
-		pv_elem_free_all(xmodel);
 		goto error;
 	}
-	pv_elem_free_all(xmodel);
 
 	return 1;
 error:




More information about the sr-dev mailing list