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

Function pv_parse_param_name

pvar.c:6212–6253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6210}
6211
6212static int pv_parse_param_name(pv_spec_p sp, const str *in)
6213{
6214 char *p;
6215 char *s;
6216 pv_spec_p nsp = 0;
6217
6218 if(in==NULL || in->s==NULL || sp==NULL)
6219 return -1;
6220 p = in->s;
6221 if(*p==PV_MARKER)
6222 {
6223 nsp = (pv_spec_p)pkg_malloc(sizeof(pv_spec_t));
6224 if(nsp==NULL)
6225 {
6226 LM_ERR("no more memory\n");
6227 return -1;
6228 }
6229 s = pv_parse_spec(in, nsp);
6230 if(s==NULL)
6231 {
6232 LM_ERR("invalid name [%.*s]\n", in->len, in->s);
6233 pv_spec_free(nsp);
6234 return -1;
6235 }
6236 sp->pvp.pvn.type = PV_NAME_PVAR;
6237 sp->pvp.pvn.u.dname = (void*)nsp;
6238 return 0;
6239 }
6240 /*LM_DBG("static name [%.*s]\n", in->len, in->s);*/
6241 /* always an int type from now */
6242 sp->pvp.pvn.u.isname.type = 0;
6243 sp->pvp.pvn.type = PV_NAME_INTSTR;
6244 /* do our best to convert it to an index */
6245 if (str2int(in, (unsigned int *)&sp->pvp.pvn.u.isname.name.n) < 0)
6246 {
6247 /* remember it was a string, so we can retrieve it later */
6248 sp->pvp.pvn.u.isname.name.s = *in;
6249 sp->pvp.pvn.u.isname.type = AVP_NAME_STR;
6250 }
6251 return 0;
6252
6253}
6254
6255static int pv_parse_return_value(pv_spec_p sp, const str *in)
6256{

Callers

nothing calls this directly

Calls 3

pv_parse_specFunction · 0.85
pv_spec_freeFunction · 0.85
str2intFunction · 0.85

Tested by

no test coverage detected