MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / parse_pvname_list

Function parse_pvname_list

pvar.c:5641–5704  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5639
5640
5641pvname_list_t* parse_pvname_list(str *in, unsigned int type)
5642{
5643 pvname_list_t* head = NULL;
5644 pvname_list_t* al = NULL;
5645 pvname_list_t* last = NULL;
5646 char *p;
5647 pv_spec_t spec;
5648 str s;
5649
5650 if(in==NULL || in->s==NULL)
5651 {
5652 LM_ERR("bad parameters\n");
5653 return NULL;
5654 }
5655
5656 p = in->s;
5657 while(is_in_str(p, in))
5658 {
5659 while(is_in_str(p, in) && (is_ws(*p)||*p==','||*p==';'))
5660 p++;
5661 if(!is_in_str(p, in))
5662 {
5663 if(head==NULL)
5664 LM_ERR("wrong item name list [%.*s]\n", in->len, in->s);
5665 return head;
5666 }
5667 s.s=p;
5668 s.len = in->s+in->len-p;
5669 p = pv_parse_spec(&s, &spec);
5670 if(p==NULL || (type && spec.type!=type))
5671 {
5672 LM_ERR("wrong item name list [%.*s]!\n", in->len, in->s);
5673 goto error;
5674 }
5675 al = (pvname_list_t*)pkg_malloc(sizeof(pvname_list_t));
5676 if(al==NULL)
5677 {
5678 LM_ERR("no more memory!\n");
5679 goto error;
5680 }
5681 memset(al, 0, sizeof(pvname_list_t));
5682 memcpy(&al->sname, &spec, sizeof(pv_spec_t));
5683
5684 if(last==NULL)
5685 {
5686 head = al;
5687 last = al;
5688 } else {
5689 last->next = al;
5690 last = al;
5691 }
5692 }
5693
5694 return head;
5695
5696error:
5697 while(head)
5698 {

Callers 4

fixup_avp_listFunction · 0.85
fixup_avpname_listFunction · 0.85
fixup_pvname_listFunction · 0.85
fixup_cache_dump_retFunction · 0.85

Calls 2

is_wsFunction · 0.85
pv_parse_specFunction · 0.85

Tested by

no test coverage detected