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

Function pv_parse_name

modules/sql_cacher/sql_cacher.c:1896–1934  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1894}
1895
1896int pv_parse_name(pv_spec_p sp, const str *in)
1897{
1898 pv_elem_t *model = NULL, *it;
1899 pv_name_fix_t *pv_name;
1900
1901 if (!in || !in->s || !sp)
1902 return -1;
1903
1904 pv_name = pkg_malloc(sizeof(pv_name_fix_t));
1905 if (!pv_name) {
1906 LM_ERR("No more pkg memory\n");
1907 return -1;
1908 }
1909 memset(pv_name, 0, sizeof *pv_name);
1910
1911 pv_name->col_offset = -1;
1912 pv_name->last_str = -1;
1913
1914 sp->pvp.pvn.type = PV_NAME_PVAR;
1915 sp->pvp.pvn.u.dname = (void *)pv_name;
1916
1917 if (pv_parse_format(in, &model) < 0) {
1918 LM_ERR("Wrong format for pvar name\n");
1919 return -1;
1920 }
1921
1922 for (it = model; it; it = it->next) {
1923 if (it->spec.type != PVT_NONE)
1924 break;
1925 }
1926 if (it) { /* if there are variables in the name, parse later */
1927 pv_name->pv_elem_list = model;
1928 } else {
1929 if (parse_pv_name_s(pv_name, &(model->text)) < 0)
1930 return -1;
1931 }
1932
1933 return 0;
1934}
1935
1936static str valbuff[PV_VAL_BUF_NO];
1937int pv_get_sql_cached_value(struct sip_msg *msg, pv_param_t *param, pv_value_t *res)

Callers

nothing calls this directly

Calls 2

pv_parse_formatFunction · 0.85
parse_pv_name_sFunction · 0.85

Tested by

no test coverage detected