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

Function new_pv_context

pvar.c:5962–5989  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5960}
5961
5962static pv_context_t* new_pv_context(const str* name, pv_contextf_t get_context)
5963{
5964 pv_context_t* pvc_new = NULL;
5965 int size;
5966/*
5967 if(get_context == NULL)
5968 {
5969 LM_ERR("NULL pointer to function\n");
5970 return 0;
5971 }
5972*/
5973 size = sizeof(pv_context_t) + name->len;
5974 pvc_new = (pv_context_t*)pkg_malloc(size);
5975 if(pvc_new == NULL)
5976 {
5977 LM_ERR("No more memory\n");
5978 return 0;
5979 }
5980 memset(pvc_new, 0, size);
5981
5982 pvc_new->name.s = (char*)pvc_new + sizeof(pv_context_t);
5983 memcpy(pvc_new->name.s, name->s, name->len);
5984 pvc_new->name.len = name->len;
5985
5986 pvc_new->contextf = get_context;
5987
5988 return pvc_new;
5989}
5990
5991int register_pv_context(char* cname, pv_contextf_t get_context)
5992{

Callers 1

add_pv_contextFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected