| 5960 | } |
| 5961 | |
| 5962 | static 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 | |
| 5991 | int register_pv_context(char* cname, pv_contextf_t get_context) |
| 5992 | { |