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

Function fixup_regcomp

mod_fix.c:34–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32static char *re_buff=NULL;
33static int re_buff_len = 0;
34int fixup_regcomp(regex_t **re, str *re_str, int dup_nt)
35{
36 char *regex;
37
38 if (dup_nt) {
39 if (re_str->len + 1 > re_buff_len) {
40 re_buff = pkg_realloc(re_buff,re_str->len + 1);
41 if (re_buff == NULL) {
42 LM_ERR("No more pkg \n");
43 return E_OUT_OF_MEM;
44 }
45
46 re_buff_len = re_str->len + 1;
47 }
48
49 memcpy(re_buff,re_str->s,re_str->len);
50 re_buff[re_str->len] = 0;
51
52 regex = re_buff;
53 } else
54 regex = re_str->s;
55
56 if ((*re = pkg_malloc(sizeof **re)) == 0) {
57 LM_ERR("no more pkg memory\n");
58 return E_OUT_OF_MEM;
59 }
60 if (regcomp(*re, regex, (REG_EXTENDED|REG_ICASE|REG_NEWLINE))) {
61 LM_ERR("bad re %s\n", regex);
62 pkg_free(*re);
63 return E_BAD_RE;
64 }
65
66 return 0;
67}
68
69static inline gparam_p alloc_gp(void)
70{

Callers 2

fix_cmdFunction · 0.85
get_cmd_fixupsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected