Branch data 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 : 16076 : Include match_include_pattern(
11 : : const char *relative_path,
12 : : bool *include_showed_once)
13 : : {
14 [ + + ]: 16076 : if(config->include == NULL)
15 : : {
16 : : // Nothing to include
17 : 15488 : return(DO_NOT_INCLUDE);
18 : : }
19 : :
20 [ + + ]: 1972 : for(int i = 0; config->include[i] != NULL; ++i)
21 : : {
22 : 1460 : REGEXP result = regexp_match(config->include[i],relative_path,include_showed_once);
23 : :
24 [ + + ]: 1460 : if(MATCH == result)
25 : : {
26 : : // Include that file
27 : 76 : return(INCLUDE);
28 : :
29 [ - + ]: 1384 : } else if(REGEXP_ERROR == result){
30 : :
31 : 0 : return(FAIL_REGEXP_INCLUDE);
32 : :
33 : : }
34 : : }
35 : :
36 : : // Don't ignore the file
37 : 512 : return(DO_NOT_INCLUDE);
38 : : }
|