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