../3rdparty/pcre/pcre_study.c

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7 -
8enum { SSB_FAIL, SSB_DONE, SSB_CONTINUE, SSB_UNKNOWN }; -
9static int -
10find_minlength(const pcre_uchar *code, const pcre_uchar *startcode, int options, -
11 int recurse_depth) -
12{ -
13int length = -1; -
14 -
15BOOL utf = (options & 0x00000800) != 0; -
16BOOL had_recurse = 0; -
17register int branchlength = 0; -
18register pcre_uchar *cc = (pcre_uchar *)code + 1 + 1; -
19 -
20if (*code == OP_CBRA || *code == OP_SCBRA ||
partially evaluated: *code == OP_CBRA
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
partially evaluated: *code == OP_SCBRA
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
21 *code == OP_CBRAPOS || *code == OP_SCBRAPOS) cc += 1;
never executed: cc += 1;
partially evaluated: *code == OP_CBRAPOS
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
partially evaluated: *code == OP_SCBRAPOS
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
22 -
23 -
24 -
25 -
26for (;;) -
27 { -
28 int d, min; -
29 pcre_uchar *cs, *ce; -
30 register int op = *cc; -
31 -
32 switch (op) -
33 { -
34 case OP_COND: -
35 case OP_SCOND: -
36 -
37 -
38 -
39 -
40 -
41 cs = cc + (cc[1]); -
42 if (*cs != OP_ALT)
never evaluated: *cs != OP_ALT
0
43 { -
44 cc = cs + 1 + 1; -
45 break;
never executed: break;
0
46 } -
47 -
48 -
49 -
50 -
51 case OP_CBRA:
code before this statement never executed: case OP_CBRA:
0
52 case OP_SCBRA: -
53 case OP_BRA: -
54 case OP_SBRA: -
55 case OP_CBRAPOS: -
56 case OP_SCBRAPOS: -
57 case OP_BRAPOS: -
58 case OP_SBRAPOS: -
59 case OP_ONCE: -
60 case OP_ONCE_NC: -
61 d = find_minlength(cc, startcode, options, recurse_depth); -
62 if (d < 0) return d;
never evaluated: d < 0
never executed: return d;
0
63 branchlength += d; -
64 do cc += (cc[1]); while (*cc == OP_ALT);
never evaluated: *cc == OP_ALT
never executed: cc += (cc[1]);
0
65 cc += 1 + 1; -
66 break;
never executed: break;
0
67 -
68 -
69 -
70 case OP_ACCEPT: -
71 case OP_ASSERT_ACCEPT: -
72 return -1;
never executed: return -1;
0
73 -
74 -
75 -
76 -
77 -
78 -
79 -
80 case OP_ALT: -
81 case OP_KET: -
82 case OP_KETRMAX: -
83 case OP_KETRMIN: -
84 case OP_KETRPOS: -
85 case OP_END: -
86 if (length < 0 || (!had_recurse && branchlength < length))
evaluated: length < 0
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:1
partially evaluated: !had_recurse
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: branchlength < length
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-15
87 length = branchlength;
executed: length = branchlength;
Execution Count:15
15
88 if (op != OP_ALT) return length;
evaluated: op != OP_ALT
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:1
executed: return length;
Execution Count:15
1-15
89 cc += 1 + 1; -
90 branchlength = 0; -
91 had_recurse = 0; -
92 break;
executed: break;
Execution Count:1
1
93 -
94 -
95 -
96 case OP_ASSERT: -
97 case OP_ASSERT_NOT: -
98 case OP_ASSERTBACK: -
99 case OP_ASSERTBACK_NOT: -
100 do cc += (cc[1]); while (*cc == OP_ALT);
never evaluated: *cc == OP_ALT
never executed: cc += (cc[1]);
0
101 -
102 -
103 -
104 -
105 case OP_REVERSE:
code before this statement never executed: case OP_REVERSE:
0
106 case OP_CREF: -
107 case OP_NCREF: -
108 case OP_RREF: -
109 case OP_NRREF: -
110 case OP_DEF: -
111 case OP_CALLOUT: -
112 case OP_SOD: -
113 case OP_SOM: -
114 case OP_EOD: -
115 case OP_EODN: -
116 case OP_CIRC: -
117 case OP_CIRCM: -
118 case OP_DOLL: -
119 case OP_DOLLM: -
120 case OP_NOT_WORD_BOUNDARY: -
121 case OP_WORD_BOUNDARY: -
122 cc += _pcre16_OP_lengths[*cc]; -
123 break;
executed: break;
Execution Count:1
1
124 -
125 -
126 -
127 case OP_BRAZERO: -
128 case OP_BRAMINZERO: -
129 case OP_BRAPOSZERO: -
130 case OP_SKIPZERO: -
131 cc += _pcre16_OP_lengths[*cc]; -
132 do cc += (cc[1]); while (*cc == OP_ALT);
never executed: cc += (cc[1]);
never evaluated: *cc == OP_ALT
0
133 cc += 1 + 1; -
134 break;
never executed: break;
0
135 -
136 -
137 -
138 case OP_CHAR: -
139 case OP_CHARI: -
140 case OP_NOT: -
141 case OP_NOTI: -
142 case OP_PLUS: -
143 case OP_PLUSI: -
144 case OP_MINPLUS: -
145 case OP_MINPLUSI: -
146 case OP_POSPLUS: -
147 case OP_POSPLUSI: -
148 case OP_NOTPLUS: -
149 case OP_NOTPLUSI: -
150 case OP_NOTMINPLUS: -
151 case OP_NOTMINPLUSI: -
152 case OP_NOTPOSPLUS: -
153 case OP_NOTPOSPLUSI: -
154 branchlength++; -
155 cc += 2; -
156 -
157 if (utf && (((cc[-1]) & 0xfc00) == 0xd800)) cc += 1;
never executed: cc += 1;
partially evaluated: utf
TRUEFALSE
yes
Evaluation Count:7
no
Evaluation Count:0
partially evaluated: (((cc[-1]) & 0xfc00) == 0xd800)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-7
158 -
159 break;
executed: break;
Execution Count:7
7
160 -
161 case OP_TYPEPLUS: -
162 case OP_TYPEMINPLUS: -
163 case OP_TYPEPOSPLUS: -
164 branchlength++; -
165 cc += (cc[1] == OP_PROP || cc[1] == OP_NOTPROP)? 4 : 2;
never evaluated: cc[1] == OP_PROP
never evaluated: cc[1] == OP_NOTPROP
0
166 break;
never executed: break;
0
167 -
168 -
169 -
170 -
171 case OP_EXACT: -
172 case OP_EXACTI: -
173 case OP_NOTEXACT: -
174 case OP_NOTEXACTI: -
175 branchlength += cc[1]; -
176 cc += 2 + 1; -
177 -
178 if (utf && (((cc[-1]) & 0xfc00) == 0xd800)) cc += 1;
never executed: cc += 1;
never evaluated: utf
never evaluated: (((cc[-1]) & 0xfc00) == 0xd800)
0
179 -
180 break;
never executed: break;
0
181 -
182 case OP_TYPEEXACT: -
183 branchlength += cc[1]; -
184 cc += 2 + 1 + ((cc[1 + 1] == OP_PROP
never evaluated: cc[1 + 1] == OP_PROP
0
185 || cc[1 + 1] == OP_NOTPROP)? 2 : 0);
never evaluated: cc[1 + 1] == OP_NOTPROP
0
186 break;
never executed: break;
0
187 -
188 -
189 -
190 case OP_PROP: -
191 case OP_NOTPROP: -
192 cc += 2; -
193 -
194 -
195 case OP_NOT_DIGIT:
code before this statement never executed: case OP_NOT_DIGIT:
0
196 case OP_DIGIT: -
197 case OP_NOT_WHITESPACE: -
198 case OP_WHITESPACE: -
199 case OP_NOT_WORDCHAR: -
200 case OP_WORDCHAR: -
201 case OP_ANY: -
202 case OP_ALLANY: -
203 case OP_EXTUNI: -
204 case OP_HSPACE: -
205 case OP_NOT_HSPACE: -
206 case OP_VSPACE: -
207 case OP_NOT_VSPACE: -
208 branchlength++; -
209 cc++; -
210 break;
never executed: break;
0
211 -
212 -
213 -
214 -
215 case OP_ANYNL: -
216 branchlength += 1; -
217 cc++; -
218 break;
never executed: break;
0
219 -
220 -
221 -
222 -
223 -
224 case OP_ANYBYTE: -
225 -
226 if (utf) return -1;
never evaluated: utf
never executed: return -1;
0
227 -
228 branchlength++; -
229 cc++; -
230 break;
never executed: break;
0
231 -
232 -
233 -
234 -
235 case OP_TYPESTAR: -
236 case OP_TYPEMINSTAR: -
237 case OP_TYPEQUERY: -
238 case OP_TYPEMINQUERY: -
239 case OP_TYPEPOSSTAR: -
240 case OP_TYPEPOSQUERY: -
241 if (cc[1] == OP_PROP || cc[1] == OP_NOTPROP) cc += 2;
partially evaluated: cc[1] == OP_PROP
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
partially evaluated: cc[1] == OP_NOTPROP
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
never executed: cc += 2;
0-5
242 cc += _pcre16_OP_lengths[op]; -
243 break;
executed: break;
Execution Count:5
5
244 -
245 case OP_TYPEUPTO: -
246 case OP_TYPEMINUPTO: -
247 case OP_TYPEPOSUPTO: -
248 if (cc[1 + 1] == OP_PROP
never evaluated: cc[1 + 1] == OP_PROP
0
249 || cc[1 + 1] == OP_NOTPROP) cc += 2;
never evaluated: cc[1 + 1] == OP_NOTPROP
never executed: cc += 2;
0
250 cc += _pcre16_OP_lengths[op]; -
251 break;
never executed: break;
0
252 -
253 -
254 -
255 -
256 case OP_XCLASS: -
257 cc += (cc[1]) - _pcre16_OP_lengths[OP_CLASS]; -
258 -
259 -
260 -
261 case OP_CLASS:
code before this statement executed: case OP_CLASS:
Execution Count:1
1
262 case OP_NCLASS: -
263 cc += _pcre16_OP_lengths[OP_CLASS]; -
264 -
265 switch (*cc) -
266 { -
267 case OP_CRPLUS: -
268 case OP_CRMINPLUS: -
269 branchlength++; -
270 -
271 -
272 case OP_CRSTAR:
code before this statement never executed: case OP_CRSTAR:
0
273 case OP_CRMINSTAR: -
274 case OP_CRQUERY: -
275 case OP_CRMINQUERY: -
276 cc++; -
277 break;
executed: break;
Execution Count:1
1
278 -
279 case OP_CRRANGE: -
280 case OP_CRMINRANGE: -
281 branchlength += cc[1]; -
282 cc += 1 + 2 * 1; -
283 break;
never executed: break;
0
284 -
285 default: -
286 branchlength++; -
287 break;
never executed: break;
0
288 } -
289 break;
executed: break;
Execution Count:1
1
290 case OP_REF: -
291 case OP_REFI: -
292 if ((options & 0x02000000) == 0)
never evaluated: (options & 0x02000000) == 0
0
293 { -
294 ce = cs = (pcre_uchar *)_pcre16_find_bracket(startcode, utf, cc[1]); -
295 if (cs == ((void *)0)) return -2;
never evaluated: cs == ((void *)0)
never executed: return -2;
0
296 do ce += (ce[1]); while (*ce == OP_ALT);
never evaluated: *ce == OP_ALT
never executed: ce += (ce[1]);
0
297 if (cc > cs && cc < ce)
never evaluated: cc > cs
never evaluated: cc < ce
0
298 { -
299 d = 0; -
300 had_recurse = 1; -
301 }
never executed: }
0
302 else -
303 { -
304 d = find_minlength(cs, startcode, options, recurse_depth); -
305 }
never executed: }
0
306 } -
307 else d = 0;
never executed: d = 0;
0
308 cc += 1 + 1; -
309 -
310 -
311 -
312 switch (*cc) -
313 { -
314 case OP_CRSTAR: -
315 case OP_CRMINSTAR: -
316 case OP_CRQUERY: -
317 case OP_CRMINQUERY: -
318 min = 0; -
319 cc++; -
320 break;
never executed: break;
0
321 -
322 case OP_CRPLUS: -
323 case OP_CRMINPLUS: -
324 min = 1; -
325 cc++; -
326 break;
never executed: break;
0
327 -
328 case OP_CRRANGE: -
329 case OP_CRMINRANGE: -
330 min = cc[1]; -
331 cc += 1 + 2 * 1; -
332 break;
never executed: break;
0
333 -
334 default: -
335 min = 1; -
336 break;
never executed: break;
0
337 } -
338 -
339 branchlength += min * d; -
340 break;
never executed: break;
0
341 -
342 -
343 -
344 -
345 case OP_RECURSE: -
346 cs = ce = (pcre_uchar *)startcode + (cc[1]); -
347 do ce += (ce[1]); while (*ce == OP_ALT);
never evaluated: *ce == OP_ALT
never executed: ce += (ce[1]);
0
348 if ((cc > cs && cc < ce) || recurse_depth > 10)
never evaluated: cc > cs
never evaluated: cc < ce
never evaluated: recurse_depth > 10
0
349 had_recurse = 1;
never executed: had_recurse = 1;
0
350 else -
351 { -
352 branchlength += find_minlength(cs, startcode, options, recurse_depth + 1); -
353 }
never executed: }
0
354 cc += 1 + 1; -
355 break;
never executed: break;
0
356 case OP_UPTO: -
357 case OP_UPTOI: -
358 case OP_NOTUPTO: -
359 case OP_NOTUPTOI: -
360 case OP_MINUPTO: -
361 case OP_MINUPTOI: -
362 case OP_NOTMINUPTO: -
363 case OP_NOTMINUPTOI: -
364 case OP_POSUPTO: -
365 case OP_POSUPTOI: -
366 case OP_NOTPOSUPTO: -
367 case OP_NOTPOSUPTOI: -
368 -
369 case OP_STAR: -
370 case OP_STARI: -
371 case OP_NOTSTAR: -
372 case OP_NOTSTARI: -
373 case OP_MINSTAR: -
374 case OP_MINSTARI: -
375 case OP_NOTMINSTAR: -
376 case OP_NOTMINSTARI: -
377 case OP_POSSTAR: -
378 case OP_POSSTARI: -
379 case OP_NOTPOSSTAR: -
380 case OP_NOTPOSSTARI: -
381 -
382 case OP_QUERY: -
383 case OP_QUERYI: -
384 case OP_NOTQUERY: -
385 case OP_NOTQUERYI: -
386 case OP_MINQUERY: -
387 case OP_MINQUERYI: -
388 case OP_NOTMINQUERY: -
389 case OP_NOTMINQUERYI: -
390 case OP_POSQUERY: -
391 case OP_POSQUERYI: -
392 case OP_NOTPOSQUERY: -
393 case OP_NOTPOSQUERYI: -
394 -
395 cc += _pcre16_OP_lengths[op]; -
396 -
397 if (utf && (((cc[-1]) & 0xfc00) == 0xd800)) cc += 1;
partially evaluated: utf
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
partially evaluated: (((cc[-1]) & 0xfc00) == 0xd800)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
never executed: cc += 1;
0-2
398 -
399 break;
executed: break;
Execution Count:2
2
400 -
401 -
402 -
403 case OP_MARK: -
404 case OP_PRUNE_ARG: -
405 case OP_SKIP_ARG: -
406 case OP_THEN_ARG: -
407 cc += _pcre16_OP_lengths[op] + cc[1]; -
408 break;
never executed: break;
0
409 -
410 -
411 -
412 case OP_CLOSE: -
413 case OP_COMMIT: -
414 case OP_FAIL: -
415 case OP_PRUNE: -
416 case OP_SET_SOM: -
417 case OP_SKIP: -
418 case OP_THEN: -
419 cc += _pcre16_OP_lengths[op]; -
420 break;
never executed: break;
0
421 -
422 -
423 -
424 -
425 default: -
426 return -3;
never executed: return -3;
0
427 } -
428 }
executed: }
Execution Count:17
17
429 -
430}
never executed: }
0
431static const pcre_uchar * -
432set_table_bit(pcre_uint8 *start_bits, const pcre_uchar *p, BOOL caseless, -
433 compile_data *cd, BOOL utf) -
434{ -
435unsigned int c = *p; -
436if (c > 0xff)
partially evaluated: c > 0xff
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
437 { -
438 c = 0xff; -
439 caseless = 0; -
440 }
never executed: }
0
441start_bits[c/8] |= (1 << (c&7)); -
442 -
443 -
444if (utf && c > 127)
partially evaluated: utf
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
partially evaluated: c > 127
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
445 { -
446 c = *p++; if ((c & 0xfc00) == 0xd800) { c = (((c & 0x3ff) << 10) | (*p++ & 0x3ff)) + 0x10000; };;
never evaluated: (c & 0xfc00) == 0xd800
never executed: }
0
447 -
448 if (caseless)
never evaluated: caseless
0
449 { -
450 c = (c + (_pcre16_ucd_records + _pcre16_ucd_stage2[_pcre16_ucd_stage1[(c) / 128] * 128 + (c) % 128])->other_case); -
451 if (c > 0xff)
never evaluated: c > 0xff
0
452 c = 0xff;
never executed: c = 0xff;
0
453 start_bits[c/8] |= (1 << (c&7)); -
454 }
never executed: }
0
455 -
456 return p;
never executed: return p;
0
457 } -
458 -
459 -
460if (caseless && (cd->ctypes[c] & 0x02) != 0) start_bits[cd->fcc[c]/8] |= (1 << (cd->fcc[c]&7));
partially evaluated: caseless
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
never evaluated: (cd->ctypes[c] & 0x02) != 0
never executed: start_bits[cd->fcc[c]/8] |= (1 << (cd->fcc[c]&7));
0-3
461return p + 1;
executed: return p + 1;
Execution Count:3
3
462 -
463} -
464static void -
465set_type_bits(pcre_uint8 *start_bits, int cbit_type, int table_limit, -
466 compile_data *cd) -
467{ -
468register int c; -
469for (c = 0; c < table_limit; c++) start_bits[c] |= cd->cbits[c+cbit_type];
never evaluated: c < table_limit
never executed: start_bits[c] |= cd->cbits[c+cbit_type];
0
470}
never executed: }
0
471static void -
472set_nottype_bits(pcre_uint8 *start_bits, int cbit_type, int table_limit, -
473 compile_data *cd) -
474{ -
475register int c; -
476for (c = 0; c < table_limit; c++) start_bits[c] |= ~cd->cbits[c+cbit_type];
never evaluated: c < table_limit
never executed: start_bits[c] |= ~cd->cbits[c+cbit_type];
0
477 -
478 -
479 -
480}
never executed: }
0
481static int -
482set_start_bits(const pcre_uchar *code, pcre_uint8 *start_bits, BOOL utf, -
483 compile_data *cd) -
484{ -
485register int c; -
486int yield = SSB_DONE; -
487 -
488 -
489 -
490int table_limit = 32; -
491do -
492 { -
493 BOOL try_next = 1; -
494 const pcre_uchar *tcode = code + 1 + 1; -
495 -
496 if (*code == OP_CBRA || *code == OP_SCBRA ||
partially evaluated: *code == OP_CBRA
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
partially evaluated: *code == OP_SCBRA
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
497 *code == OP_CBRAPOS || *code == OP_SCBRAPOS) tcode += 1;
partially evaluated: *code == OP_CBRAPOS
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
partially evaluated: *code == OP_SCBRAPOS
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
never executed: tcode += 1;
0-5
498 -
499 while (try_next)
evaluated: try_next
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:2
2-8
500 { -
501 int rc; -
502 -
503 switch(*tcode) -
504 { -
505 -
506 -
507 -
508 -
509 default: -
510 return SSB_UNKNOWN;
never executed: return SSB_UNKNOWN;
0
511 -
512 -
513 -
514 case OP_ACCEPT: -
515 case OP_ASSERT_ACCEPT: -
516 case OP_ALLANY: -
517 case OP_ANY: -
518 case OP_ANYBYTE: -
519 case OP_CIRC: -
520 case OP_CIRCM: -
521 case OP_CLOSE: -
522 case OP_COMMIT: -
523 case OP_COND: -
524 case OP_CREF: -
525 case OP_DEF: -
526 case OP_DOLL: -
527 case OP_DOLLM: -
528 case OP_END: -
529 case OP_EOD: -
530 case OP_EODN: -
531 case OP_EXTUNI: -
532 case OP_FAIL: -
533 case OP_MARK: -
534 case OP_NCREF: -
535 case OP_NOT: -
536 case OP_NOTEXACT: -
537 case OP_NOTEXACTI: -
538 case OP_NOTI: -
539 case OP_NOTMINPLUS: -
540 case OP_NOTMINPLUSI: -
541 case OP_NOTMINQUERY: -
542 case OP_NOTMINQUERYI: -
543 case OP_NOTMINSTAR: -
544 case OP_NOTMINSTARI: -
545 case OP_NOTMINUPTO: -
546 case OP_NOTMINUPTOI: -
547 case OP_NOTPLUS: -
548 case OP_NOTPLUSI: -
549 case OP_NOTPOSPLUS: -
550 case OP_NOTPOSPLUSI: -
551 case OP_NOTPOSQUERY: -
552 case OP_NOTPOSQUERYI: -
553 case OP_NOTPOSSTAR: -
554 case OP_NOTPOSSTARI: -
555 case OP_NOTPOSUPTO: -
556 case OP_NOTPOSUPTOI: -
557 case OP_NOTPROP: -
558 case OP_NOTQUERY: -
559 case OP_NOTQUERYI: -
560 case OP_NOTSTAR: -
561 case OP_NOTSTARI: -
562 case OP_NOTUPTO: -
563 case OP_NOTUPTOI: -
564 case OP_NOT_HSPACE: -
565 case OP_NOT_VSPACE: -
566 case OP_NRREF: -
567 case OP_PROP: -
568 case OP_PRUNE: -
569 case OP_PRUNE_ARG: -
570 case OP_RECURSE: -
571 case OP_REF: -
572 case OP_REFI: -
573 case OP_REVERSE: -
574 case OP_RREF: -
575 case OP_SCOND: -
576 case OP_SET_SOM: -
577 case OP_SKIP: -
578 case OP_SKIP_ARG: -
579 case OP_SOD: -
580 case OP_SOM: -
581 case OP_THEN: -
582 case OP_THEN_ARG: -
583 -
584 case OP_XCLASS: -
585 -
586 return SSB_FAIL;
executed: return SSB_FAIL;
Execution Count:1
1
587 -
588 -
589 -
590 case OP_WORD_BOUNDARY: -
591 case OP_NOT_WORD_BOUNDARY: -
592 tcode++; -
593 break;
executed: break;
Execution Count:1
1
594 -
595 -
596 -
597 -
598 -
599 -
600 case OP_BRA: -
601 case OP_SBRA: -
602 case OP_CBRA: -
603 case OP_SCBRA: -
604 case OP_BRAPOS: -
605 case OP_SBRAPOS: -
606 case OP_CBRAPOS: -
607 case OP_SCBRAPOS: -
608 case OP_ONCE: -
609 case OP_ONCE_NC: -
610 case OP_ASSERT: -
611 rc = set_start_bits(tcode, start_bits, utf, cd); -
612 if (rc == SSB_FAIL || rc == SSB_UNKNOWN) return rc;
never evaluated: rc == SSB_FAIL
never evaluated: rc == SSB_UNKNOWN
never executed: return rc;
0
613 if (rc == SSB_DONE) try_next = 0; else
never evaluated: rc == SSB_DONE
never executed: try_next = 0;
0
614 { -
615 do tcode += (tcode[1]); while (*tcode == OP_ALT);
never evaluated: *tcode == OP_ALT
never executed: tcode += (tcode[1]);
0
616 tcode += 1 + 1; -
617 }
never executed: }
0
618 break;
never executed: break;
0
619 case OP_ALT: -
620 yield = SSB_CONTINUE; -
621 try_next = 0; -
622 break;
executed: break;
Execution Count:1
1
623 -
624 case OP_KET: -
625 case OP_KETRMAX: -
626 case OP_KETRMIN: -
627 case OP_KETRPOS: -
628 return SSB_CONTINUE;
executed: return SSB_CONTINUE;
Execution Count:2
2
629 -
630 -
631 -
632 case OP_CALLOUT: -
633 tcode += 2 + 2*1; -
634 break;
never executed: break;
0
635 -
636 -
637 -
638 case OP_ASSERT_NOT: -
639 case OP_ASSERTBACK: -
640 case OP_ASSERTBACK_NOT: -
641 do tcode += (tcode[1]); while (*tcode == OP_ALT);
never evaluated: *tcode == OP_ALT
never executed: tcode += (tcode[1]);
0
642 tcode += 1 + 1; -
643 break;
never executed: break;
0
644 -
645 -
646 -
647 case OP_BRAZERO: -
648 case OP_BRAMINZERO: -
649 case OP_BRAPOSZERO: -
650 rc = set_start_bits(++tcode, start_bits, utf, cd); -
651 if (rc == SSB_FAIL || rc == SSB_UNKNOWN) return rc;
never evaluated: rc == SSB_FAIL
never evaluated: rc == SSB_UNKNOWN
never executed: return rc;
0
652 -
653 -
654 -
655 -
656 -
657 do tcode += (tcode[1]); while (*tcode == OP_ALT);
never evaluated: *tcode == OP_ALT
never executed: tcode += (tcode[1]);
0
658 tcode += 1 + 1; -
659 break;
never executed: break;
0
660 -
661 -
662 -
663 case OP_SKIPZERO: -
664 tcode++; -
665 do tcode += (tcode[1]); while (*tcode == OP_ALT);
never evaluated: *tcode == OP_ALT
never executed: tcode += (tcode[1]);
0
666 tcode += 1 + 1; -
667 break;
never executed: break;
0
668 -
669 -
670 -
671 case OP_STAR: -
672 case OP_MINSTAR: -
673 case OP_POSSTAR: -
674 case OP_QUERY: -
675 case OP_MINQUERY: -
676 case OP_POSQUERY: -
677 tcode = set_table_bit(start_bits, tcode + 1, 0, cd, utf); -
678 break;
executed: break;
Execution Count:2
2
679 -
680 case OP_STARI: -
681 case OP_MINSTARI: -
682 case OP_POSSTARI: -
683 case OP_QUERYI: -
684 case OP_MINQUERYI: -
685 case OP_POSQUERYI: -
686 tcode = set_table_bit(start_bits, tcode + 1, 1, cd, utf); -
687 break;
never executed: break;
0
688 -
689 -
690 -
691 case OP_UPTO: -
692 case OP_MINUPTO: -
693 case OP_POSUPTO: -
694 tcode = set_table_bit(start_bits, tcode + 1 + 1, 0, cd, utf); -
695 break;
never executed: break;
0
696 -
697 case OP_UPTOI: -
698 case OP_MINUPTOI: -
699 case OP_POSUPTOI: -
700 tcode = set_table_bit(start_bits, tcode + 1 + 1, 1, cd, utf); -
701 break;
never executed: break;
0
702 -
703 -
704 -
705 case OP_EXACT: -
706 tcode += 1; -
707 -
708 case OP_CHAR:
code before this statement never executed: case OP_CHAR:
0
709 case OP_PLUS: -
710 case OP_MINPLUS: -
711 case OP_POSPLUS: -
712 (void)set_table_bit(start_bits, tcode + 1, 0, cd, utf); -
713 try_next = 0; -
714 break;
executed: break;
Execution Count:1
1
715 -
716 case OP_EXACTI: -
717 tcode += 1; -
718 -
719 case OP_CHARI:
code before this statement never executed: case OP_CHARI:
0
720 case OP_PLUSI: -
721 case OP_MINPLUSI: -
722 case OP_POSPLUSI: -
723 (void)set_table_bit(start_bits, tcode + 1, 1, cd, utf); -
724 try_next = 0; -
725 break;
never executed: break;
0
726 -
727 -
728 -
729 -
730 -
731 -
732 -
733 case OP_HSPACE: -
734 start_bits[0x09/8] |= (1 << (0x09&7)); -
735 start_bits[0x20/8] |= (1 << (0x20&7)); -
736 -
737 if (utf)
never evaluated: utf
0
738 { -
739 -
740 -
741 -
742 -
743 -
744 -
745 -
746 start_bits[0xA0/8] |= (1 << (0xA0&7)); -
747 start_bits[0xFF/8] |= (1 << (0xFF&7)); -
748 -
749 }
never executed: }
0
750 else -
751 -
752 { -
753 start_bits[0xA0/8] |= (1 << (0xA0&7)); -
754 -
755 start_bits[0xFF/8] |= (1 << (0xFF&7)); -
756 -
757 }
never executed: }
0
758 try_next = 0; -
759 break;
never executed: break;
0
760 -
761 case OP_ANYNL: -
762 case OP_VSPACE: -
763 start_bits[0x0A/8] |= (1 << (0x0A&7)); -
764 start_bits[0x0B/8] |= (1 << (0x0B&7)); -
765 start_bits[0x0C/8] |= (1 << (0x0C&7)); -
766 start_bits[0x0D/8] |= (1 << (0x0D&7)); -
767 -
768 if (utf)
never evaluated: utf
0
769 { -
770 -
771 -
772 -
773 -
774 -
775 start_bits[0x85/8] |= (1 << (0x85&7)); -
776 start_bits[0xFF/8] |= (1 << (0xFF&7)); -
777 -
778 }
never executed: }
0
779 else -
780 -
781 { -
782 start_bits[0x85/8] |= (1 << (0x85&7)); -
783 -
784 start_bits[0xFF/8] |= (1 << (0xFF&7)); -
785 -
786 }
never executed: }
0
787 try_next = 0; -
788 break;
never executed: break;
0
789 -
790 -
791 -
792 -
793 -
794 -
795 case OP_NOT_DIGIT: -
796 set_nottype_bits(start_bits, 64, table_limit, cd); -
797 try_next = 0; -
798 break;
never executed: break;
0
799 -
800 case OP_DIGIT: -
801 set_type_bits(start_bits, 64, table_limit, cd); -
802 try_next = 0; -
803 break;
never executed: break;
0
804 -
805 -
806 -
807 -
808 case OP_NOT_WHITESPACE: -
809 set_nottype_bits(start_bits, 0, table_limit, cd); -
810 start_bits[1] |= 0x08; -
811 try_next = 0; -
812 break;
never executed: break;
0
813 -
814 -
815 -
816 -
817 case OP_WHITESPACE: -
818 c = start_bits[1]; -
819 set_type_bits(start_bits, 0, table_limit, cd); -
820 start_bits[1] = (start_bits[1] & ~0x08) | c; -
821 try_next = 0; -
822 break;
never executed: break;
0
823 -
824 case OP_NOT_WORDCHAR: -
825 set_nottype_bits(start_bits, 160, table_limit, cd); -
826 try_next = 0; -
827 break;
never executed: break;
0
828 -
829 case OP_WORDCHAR: -
830 set_type_bits(start_bits, 160, table_limit, cd); -
831 try_next = 0; -
832 break;
never executed: break;
0
833 -
834 -
835 -
836 -
837 case OP_TYPEPLUS: -
838 case OP_TYPEMINPLUS: -
839 case OP_TYPEPOSPLUS: -
840 tcode++; -
841 break;
never executed: break;
0
842 -
843 case OP_TYPEEXACT: -
844 tcode += 1 + 1; -
845 break;
never executed: break;
0
846 -
847 -
848 -
849 -
850 case OP_TYPEUPTO: -
851 case OP_TYPEMINUPTO: -
852 case OP_TYPEPOSUPTO: -
853 tcode += 1; -
854 -
855 case OP_TYPESTAR:
code before this statement never executed: case OP_TYPESTAR:
0
856 case OP_TYPEMINSTAR: -
857 case OP_TYPEPOSSTAR: -
858 case OP_TYPEQUERY: -
859 case OP_TYPEMINQUERY: -
860 case OP_TYPEPOSQUERY: -
861 switch(tcode[1]) -
862 { -
863 default: -
864 case OP_ANY: -
865 case OP_ALLANY: -
866 return SSB_FAIL;
never executed: return SSB_FAIL;
0
867 -
868 case OP_HSPACE: -
869 start_bits[0x09/8] |= (1 << (0x09&7)); -
870 start_bits[0x20/8] |= (1 << (0x20&7)); -
871 start_bits[0xA0/8] |= (1 << (0xA0&7)); -
872 break;
never executed: break;
0
873 -
874 case OP_ANYNL: -
875 case OP_VSPACE: -
876 start_bits[0x0A/8] |= (1 << (0x0A&7)); -
877 start_bits[0x0B/8] |= (1 << (0x0B&7)); -
878 start_bits[0x0C/8] |= (1 << (0x0C&7)); -
879 start_bits[0x0D/8] |= (1 << (0x0D&7)); -
880 start_bits[0x85/8] |= (1 << (0x85&7)); -
881 break;
never executed: break;
0
882 -
883 case OP_NOT_DIGIT: -
884 set_nottype_bits(start_bits, 64, table_limit, cd); -
885 break;
never executed: break;
0
886 -
887 case OP_DIGIT: -
888 set_type_bits(start_bits, 64, table_limit, cd); -
889 break;
never executed: break;
0
890 -
891 -
892 -
893 -
894 case OP_NOT_WHITESPACE: -
895 set_nottype_bits(start_bits, 0, table_limit, cd); -
896 start_bits[1] |= 0x08; -
897 break;
never executed: break;
0
898 -
899 -
900 -
901 -
902 case OP_WHITESPACE: -
903 c = start_bits[1]; -
904 set_type_bits(start_bits, 0, table_limit, cd); -
905 start_bits[1] = (start_bits[1] & ~0x08) | c; -
906 break;
never executed: break;
0
907 -
908 case OP_NOT_WORDCHAR: -
909 set_nottype_bits(start_bits, 160, table_limit, cd); -
910 break;
never executed: break;
0
911 -
912 case OP_WORDCHAR: -
913 set_type_bits(start_bits, 160, table_limit, cd); -
914 break;
never executed: break;
0
915 } -
916 -
917 tcode += 2; -
918 break;
never executed: break;
0
919 -
920 -
921 -
922 -
923 -
924 -
925 -
926 case OP_NCLASS: -
927 start_bits[0xFF/8] |= (1 << (0xFF&7)); -
928 -
929 -
930 -
931 case OP_CLASS:
code before this statement never executed: case OP_CLASS:
0
932 { -
933 pcre_uint8 *map; -
934 tcode++; -
935 map = (pcre_uint8 *)tcode; -
936 { -
937 -
938 for (c = 0; c < 32; c++) start_bits[c] |= map[c];
never executed: start_bits[c] |= map[c];
never evaluated: c < 32
0
939 } -
940 -
941 -
942 -
943 -
944 tcode += 32 / sizeof(pcre_uchar); -
945 switch (*tcode) -
946 { -
947 case OP_CRSTAR: -
948 case OP_CRMINSTAR: -
949 case OP_CRQUERY: -
950 case OP_CRMINQUERY: -
951 tcode++; -
952 break;
never executed: break;
0
953 -
954 case OP_CRRANGE: -
955 case OP_CRMINRANGE: -
956 if (tcode[1] == 0) tcode += 1 + 2 * 1;
never executed: tcode += 1 + 2 * 1;
never evaluated: tcode[1] == 0
0
957 else try_next = 0;
never executed: try_next = 0;
0
958 break;
never executed: break;
0
959 -
960 default: -
961 try_next = 0; -
962 break;
never executed: break;
0
963 } -
964 } -
965 break;
never executed: break;
0
966 -
967 } -
968 }
executed: }
Execution Count:5
5
969 -
970 code += (code[1]); -
971 }
executed: }
Execution Count:2
2
972while (*code == OP_ALT);
evaluated: *code == OP_ALT
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
973return yield;
executed: return yield;
Execution Count:1
1
974} -
975extern pcre16_extra * -
976pcre16_study(const pcre16 *external_re, int options, const char **errorptr) -
977 -
978{ -
979int min; -
980BOOL bits_set = 0; -
981pcre_uint8 start_bits[32]; -
982pcre16_extra *extra = ((void *)0); -
983pcre_study_data *study; -
984const pcre_uint8 *tables; -
985pcre_uchar *code; -
986compile_data compile_block; -
987const real_pcre16 *re = (const real_pcre16 *)external_re; -
988 -
989*errorptr = ((void *)0); -
990 -
991if (re == ((void *)0) || re->magic_number != 0x50435245UL)
partially evaluated: re == ((void *)0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
partially evaluated: re->magic_number != 0x50435245UL
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
992 { -
993 *errorptr = "argument is not a compiled regular expression"; -
994 return ((void *)0);
never executed: return ((void *)0);
0
995 } -
996 -
997if ((re->flags & 0x0002) == 0)
partially evaluated: (re->flags & 0x0002) == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
998 { -
999 -
1000 -
1001 -
1002 *errorptr = "argument is compiled in 8 bit mode"; -
1003 -
1004 return ((void *)0);
never executed: return ((void *)0);
0
1005 } -
1006 -
1007if ((options & ~0x0001) != 0)
partially evaluated: (options & ~0x0001) != 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
1008 { -
1009 *errorptr = "unknown or incorrect option bit(s) set"; -
1010 return ((void *)0);
never executed: return ((void *)0);
0
1011 } -
1012 -
1013code = (pcre_uchar *)re + re->name_table_offset + -
1014 (re->name_count * re->name_entry_size); -
1015 -
1016 -
1017 -
1018 -
1019 -
1020if ((re->options & 0x00000010) == 0 &&
partially evaluated: (re->options & 0x00000010) == 0
TRUEFALSE
yes
Evaluation Count:15
no
Evaluation Count:0
0-15
1021 (re->flags & (0x0010|0x0100)) == 0)
evaluated: (re->flags & (0x0010|0x0100)) == 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:11
4-11
1022 { -
1023 int rc; -
1024 -
1025 -
1026 -
1027 tables = re->tables; -
1028 -
1029 -
1030 -
1031 -
1032 -
1033 -
1034 if (tables == ((void *)0))
partially evaluated: tables == ((void *)0)
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
1035 (void)pcre16_fullinfo(external_re, ((void *)0), 11, 4
1036 (void *)(&tables));
executed: (void)pcre16_fullinfo(external_re, ((void *)0), 11, (void *)(&tables));
Execution Count:4
4
1037 -
1038 -
1039 compile_block.lcc = tables + 0; -
1040 compile_block.fcc = tables + 256; -
1041 compile_block.cbits = tables + 512; -
1042 compile_block.ctypes = tables + (512 + 320); -
1043 -
1044 -
1045 -
1046 memset(start_bits, 0, 32 * sizeof(pcre_uint8)); -
1047 rc = set_start_bits(code, start_bits, (re->options & 0x00000800) != 0, -
1048 &compile_block); -
1049 bits_set = rc == SSB_DONE; -
1050 if (rc == SSB_UNKNOWN)
partially evaluated: rc == SSB_UNKNOWN
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
1051 { -
1052 *errorptr = "internal error: opcode not recognized"; -
1053 return ((void *)0);
never executed: return ((void *)0);
0
1054 } -
1055 }
executed: }
Execution Count:4
4
1056 -
1057 -
1058 -
1059switch(min = find_minlength(code, code, re->options, 0)) -
1060 { -
1061 case -2: *errorptr = "internal error: missing capturing bracket"; return ((void *)0);
never executed: return ((void *)0);
0
1062 case -3: *errorptr = "internal error: opcode not recognized"; return ((void *)0);
never executed: return ((void *)0);
0
1063 default: break;
executed: break;
Execution Count:15
15
1064 } -
1065if (bits_set || min > 0
partially evaluated: bits_set
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
evaluated: min > 0
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:9
0-15
1066 -
1067 || (options & 0x0001) != 0
partially evaluated: (options & 0x0001) != 0
TRUEFALSE
yes
Evaluation Count:9
no
Evaluation Count:0
0-9
1068 -
1069 ) -
1070 { -
1071 extra = (pcre16_extra *)(pcre16_malloc) -
1072 (sizeof(pcre16_extra) + sizeof(pcre_study_data)); -
1073 if (extra == ((void *)0))
partially evaluated: extra == ((void *)0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
1074 { -
1075 *errorptr = "failed to get memory"; -
1076 return ((void *)0);
never executed: return ((void *)0);
0
1077 } -
1078 -
1079 study = (pcre_study_data *)((char *)extra + sizeof(pcre16_extra)); -
1080 extra->flags = 0x0001; -
1081 extra->study_data = study; -
1082 -
1083 study->size = sizeof(pcre_study_data); -
1084 study->flags = 0; -
1085 -
1086 -
1087 -
1088 -
1089 -
1090 if (bits_set)
partially evaluated: bits_set
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
1091 { -
1092 study->flags |= 0x0001; -
1093 memcpy(study->start_bits, start_bits, sizeof(start_bits)); -
1094 }
never executed: }
0
1095 else memset(study->start_bits, 0, 32 * sizeof(pcre_uint8));
executed: memset(study->start_bits, 0, 32 * sizeof(pcre_uint8));
Execution Count:15
15
1096 if (min > 0)
evaluated: min > 0
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:9
6-9
1097 { -
1098 study->flags |= 0x0002; -
1099 study->minlength = min; -
1100 }
executed: }
Execution Count:6
6
1101 else study->minlength = 0;
executed: study->minlength = 0;
Execution Count:9
9
1102 -
1103 -
1104 -
1105 -
1106 -
1107 -
1108 extra->executable_jit = ((void *)0); -
1109 if ((options & 0x0001) != 0) _pcre16_jit_compile(re, extra);
executed: _pcre16_jit_compile(re, extra);
Execution Count:15
partially evaluated: (options & 0x0001) != 0
TRUEFALSE
yes
Evaluation Count:15
no
Evaluation Count:0
0-15
1110 if (study->flags == 0 && (extra->flags & 0x0040) == 0)
evaluated: study->flags == 0
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:6
partially evaluated: (extra->flags & 0x0040) == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
1111 { -
1112 -
1113 -
1114 -
1115 -
1116 pcre16_free_study(extra); -
1117 -
1118 extra = ((void *)0); -
1119 }
never executed: }
0
1120 -
1121 }
executed: }
Execution Count:15
15
1122 -
1123return extra;
executed: return extra;
Execution Count:15
15
1124} -
1125extern void -
1126pcre16_free_study(pcre16_extra *extra) -
1127 -
1128{ -
1129if (extra == ((void *)0))
evaluated: extra == ((void *)0)
TRUEFALSE
yes
Evaluation Count:937
yes
Evaluation Count:15
15-937
1130 return;
executed: return;
Execution Count:937
937
1131 -
1132if ((extra->flags & 0x0040) != 0 &&
partially evaluated: (extra->flags & 0x0040) != 0
TRUEFALSE
yes
Evaluation Count:15
no
Evaluation Count:0
0-15
1133 extra->executable_jit != ((void *)0))
partially evaluated: extra->executable_jit != ((void *)0)
TRUEFALSE
yes
Evaluation Count:15
no
Evaluation Count:0
0-15
1134 _pcre16_jit_free(extra->executable_jit);
executed: _pcre16_jit_free(extra->executable_jit);
Execution Count:15
15
1135 -
1136pcre16_free(extra); -
1137}
executed: }
Execution Count:15
15
1138 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial