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

Function parse_repl

re.c:80–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78
79#define MAX_REPLACE_WITH 100
80int parse_repl(struct replace_with * rw, char ** begin,
81 char * end, int *max_token_nb, int with_sep)
82{
83
84 char* p0;
85 char * repl;
86 str s;
87 int token_nb;
88 int escape;
89 int max_pmatch;
90 char *p, c;
91
92 /* parse replacement */
93 p = *begin;
94 c = *p;
95 if(with_sep)
96 p++;
97 repl= p;
98 token_nb=0;
99 max_pmatch=0;
100 escape=0;
101 for(;p<end; p++){
102 if (escape){
103 escape=0;
104 switch (*p){
105 /* special char escapes */
106 case '\\':
107 rw[token_nb].size=2;
108 rw[token_nb].offset=(p-1)-repl;
109 rw[token_nb].type=REPLACE_CHAR;
110 rw[token_nb].u.c='\\';
111 break;
112 case 'n':
113 rw[token_nb].size=2;
114 rw[token_nb].offset=(p-1)-repl;
115 rw[token_nb].type=REPLACE_CHAR;
116 rw[token_nb].u.c='\n';
117 break;
118 case 'r':
119 rw[token_nb].size=2;
120 rw[token_nb].offset=(p-1)-repl;
121 rw[token_nb].type=REPLACE_CHAR;
122 rw[token_nb].u.c='\r';
123 break;
124 case 't':
125 rw[token_nb].size=2;
126 rw[token_nb].offset=(p-1)-repl;
127 rw[token_nb].type=REPLACE_CHAR;
128 rw[token_nb].u.c='\t';
129 break;
130 case PV_MARKER:
131 rw[token_nb].size=2;
132 rw[token_nb].offset=(p-1)-repl;
133 rw[token_nb].type=REPLACE_CHAR;
134 rw[token_nb].u.c=PV_MARKER;
135 break;
136 /* special sip msg parts escapes */
137 case 'u':

Callers 2

subst_parserFunction · 0.85
repl_exp_parseFunction · 0.85

Calls 1

pv_parse_specFunction · 0.85

Tested by

no test coverage detected