Line data Source code
1 : #include "precizer.h"
2 :
3 : /**
4 : *
5 : * Decide whether or not to include previously ignored relative
6 : * path to the file by comparing it with PCRE2 regular
7 : * expressions passed as arguments with --include=
8 : *
9 : */
10 1406 : Include match_include_pattern(
11 : const char *relative_path,
12 : bool *include_showed_once)
13 : {
14 1406 : if(config->include == NULL)
15 : {
16 : // Nothing to include
17 1358 : return(DO_NOT_INCLUDE);
18 : }
19 :
20 136 : for(int i = 0; config->include[i] != NULL; ++i)
21 : {
22 94 : REGEXP result = regexp_match(config->include[i],relative_path,include_showed_once);
23 :
24 94 : if(MATCH == result)
25 : {
26 : // Include that file
27 6 : return(INCLUDE);
28 :
29 88 : } else if(REGEXP_ERROR == result){
30 :
31 0 : return(FAIL_REGEXP_INCLUDE);
32 :
33 : }
34 : }
35 :
36 : // Don't ignore the file
37 42 : return(DO_NOT_INCLUDE);
38 : }
|