[sr-dev] git:master: core/pvapi: more verbose error logging in parse_pvname_list()

Alex Hermann alex at speakup.nl
Sat Aug 20 10:25:28 CEST 2011


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

Author: Alex Hermann <alex at speakup.nl>
Committer: Alex Hermann <alex at speakup.nl>
Date:   Fri Aug 19 13:08:54 2011 +0200

core/pvapi: more verbose error logging in parse_pvname_list()

---

 pvapi.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/pvapi.c b/pvapi.c
index d4104c2..ff76eb2 100644
--- a/pvapi.c
+++ b/pvapi.c
@@ -1102,15 +1102,20 @@ pvname_list_t* parse_pvname_list(str *in, unsigned int type)
 		if(!is_in_str(p, in))
 		{
 			if(head==NULL)
-				LM_ERR("wrong item name list [%.*s]\n", in->len, in->s);
+				LM_ERR("parse error in name list [%.*s]\n", in->len, in->s);
 			return head;
 		}
-		s.s=p;
-		s.len = in->s+in->len-p;
+		s.s = p;
+		s.len = in->s + in->len - p;
 		p = pv_parse_spec(&s, &spec);
-		if(p==NULL || (type && spec.type!=type))
+		if(p==NULL)
+		{
+			LM_ERR("parse error in item [%.*s]\n", s.len, s.s);
+			goto error;
+		}
+		if(type && spec.type!=type)
 		{
-			LM_ERR("wrong item name list [%.*s]!\n", in->len, in->s);
+			LM_ERR("wrong type for item [%.*s]\n", (int)(p-s.s), s.s);
 			goto error;
 		}
 		al = (pvname_list_t*)pkg_malloc(sizeof(pvname_list_t));




More information about the sr-dev mailing list