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

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date:   Sun Apr 13 22:19:15 2014 +0200

pv: use pv cache to lookup avp name for $cnt(...)

---

 modules/pv/pv_core.c |   21 ++++++---------------
 1 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/modules/pv/pv_core.c b/modules/pv/pv_core.c
index 0afd9b1..ecf956a 100644
--- a/modules/pv/pv_core.c
+++ b/modules/pv/pv_core.c
@@ -2779,30 +2779,21 @@ int pv_parse_cnt_name(pv_spec_p sp, str *in)
        if(in->s==NULL || in->len<=0)
                return -1;
 
+       pv = pv_cache_get(in);
        pv = (pv_spec_t*)pkg_malloc(sizeof(pv_spec_t));
-       if(pv==NULL)
+       if(pv==NULL) {
+               LM_ERR("cannot find pv name [%.*s]\n", in->len, in->s);
                return -1;
+       }
 
-       memset(pv, 0, sizeof(pv_spec_t));
-
-       if(pv_parse_spec(in, pv)==NULL)
-               goto error;
-
-       if(pv->type!=PVT_AVP)
-       {
+       if(pv->type!=PVT_AVP) {
                LM_ERR("expected avp name instead of [%.*s]\n", in->len, in->s);
-               goto error;
+               return -1;
        }
 
        sp->pvp.pvn.u.dname = (void*)pv;
        sp->pvp.pvn.type = PV_NAME_PVAR;
        return 0;
-
-error:
-       LM_ERR("invalid pv name [%.*s]\n", in->len, in->s);
-       if(pv!=NULL)
-               pkg_free(pv);
-       return -1;
 }
 
 


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to