GCC Code Coverage Report


Directory: ../replacer/
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 20 / 0 / 20
Functions: 100.0% 2 / 0 / 2
Branches: 78.9% 15 / 0 / 19

envfilter.c
Line Branch Exec Source
1 /* C code produced by gperf version 3.0.4 */
2 /* Command-line: gperf -l -C -m20 -Ni360_env_filter_check -H_i360_env_filter_hash --null-strings env.list */
3 /* Computed positions: -k'2,11,14' */
4
5 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
6 && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
7 && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
8 && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
9 && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
10 && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
11 && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
12 && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
13 && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
14 && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
15 && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
16 && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
17 && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
18 && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
19 && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
20 && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
21 && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
22 && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
23 && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
24 && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
25 && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
26 && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
27 && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
28 /* The character set is not based on ISO-646. */
29 error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
30 #endif
31
32
33 #define TOTAL_KEYWORDS 26
34 #define MIN_WORD_LENGTH 9
35 #define MAX_WORD_LENGTH 20
36 #define MIN_HASH_VALUE 10
37 #define MAX_HASH_VALUE 36
38 /* maximum key range = 27, duplicates = 0 */
39
40 #ifdef __GNUC__
41 __inline
42 #else
43 #ifdef __cplusplus
44 inline
45 #endif
46 #endif
47 static unsigned int
48 68 _i360_env_filter_hash (str, len)
49 register const char *str;
50 register unsigned int len;
51 {
52 static const unsigned char asso_values[] =
53 {
54 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
55 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
56 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
57 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
58 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
59 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
60 37, 37, 37, 37, 37, 15, 37, 5, 15, 0,
61 37, 37, 0, 15, 3, 37, 37, 3, 15, 6,
62 37, 37, 2, 5, 1, 7, 37, 37, 37, 37,
63 37, 37, 37, 37, 37, 1, 37, 37, 37, 37,
64 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
65 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
66 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
67 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
68 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
69 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
70 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
71 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
72 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
73 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
74 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
75 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
76 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
77 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
78 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
79 37, 37, 37, 37, 37, 37
80 };
81 68 register int hval = len;
82
83
3/3
✓ Branch 2 → 3 taken 38 times.
✓ Branch 2 → 4 taken 20 times.
✓ Branch 2 → 5 taken 10 times.
68 switch (hval)
84 {
85 38 default:
86 38 hval += asso_values[(unsigned char)str[13]];
87 /*FALLTHROUGH*/
88 58 case 13:
89 case 12:
90 case 11:
91 58 hval += asso_values[(unsigned char)str[10]];
92 /*FALLTHROUGH*/
93 68 case 10:
94 case 9:
95 case 8:
96 case 7:
97 case 6:
98 case 5:
99 case 4:
100 case 3:
101 case 2:
102 68 hval += asso_values[(unsigned char)str[1]];
103 68 break;
104 }
105 68 return hval;
106 }
107
108 #ifdef __GNUC__
109 __inline
110 #if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
111 __attribute__ ((__gnu_inline__))
112 #endif
113 #endif
114 const char *
115 130 i360_env_filter_check (str, len)
116 register const char *str;
117 register unsigned int len;
118 {
119 static const unsigned char lengthtable[] =
120 {
121 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 11, 11, 11,
122 14, 10, 11, 0, 15, 18, 0, 18, 15, 15, 0, 13, 11, 19,
123 16, 19, 14, 0, 0, 16, 12, 16, 0
124 };
125 static const char * const wordlist[] =
126 {
127 (char*)0, (char*)0, (char*)0, (char*)0,
128 (char*)0, (char*)0, (char*)0, (char*)0,
129 (char*)0, (char*)0,
130 "HTTP_HOST",
131 "SERVER_NAME",
132 "SERVER_PORT",
133 "REMOTE_ADDR",
134 "REQUEST_SCHEME",
135 "SCRIPT_URI",
136 "SCRIPT_NAME",
137 (char*)0,
138 "PHPE_SCRIPT_URI",
139 "PHPE_DOCUMENT_ROOT",
140 (char*)0,
141 "HTTP_REPEATER_HASH",
142 "HTTP_TEST_SUITE",
143 "SCRIPT_FILENAME",
144 (char*)0,
145 "DOCUMENT_ROOT",
146 "REQUEST_URI",
147 "PHPE_REQUEST_METHOD",
148 "PHPE_REQUEST_URI",
149 "PHPE_REQUEST_SCHEME",
150 "REQUEST_METHOD",
151 (char*)0,
152 (char*)0,
153 "PHPE_SERVER_NAME",
154 "QUERY_STRING",
155 "HTTP_JENKINS_JOB",
156 (char*)0
157 };
158
159
4/4
✓ Branch 2 → 3 taken 124 times.
✓ Branch 2 → 12 taken 6 times.
✓ Branch 3 → 4 taken 68 times.
✓ Branch 3 → 12 taken 56 times.
130 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
160 {
161 68 register int key = _i360_env_filter_hash (str, len);
162
163
3/4
✓ Branch 5 → 6 taken 28 times.
✓ Branch 5 → 12 taken 40 times.
✓ Branch 6 → 7 taken 28 times.
✗ Branch 6 → 12 not taken.
68 if (key <= MAX_HASH_VALUE && key >= 0)
164
2/2
✓ Branch 7 → 8 taken 8 times.
✓ Branch 7 → 12 taken 20 times.
28 if (len == lengthtable[key])
165 {
166 8 register const char *s = wordlist[key];
167
168
3/6
✓ Branch 8 → 9 taken 8 times.
✗ Branch 8 → 12 not taken.
✓ Branch 9 → 10 taken 8 times.
✗ Branch 9 → 12 not taken.
✓ Branch 10 → 11 taken 8 times.
✗ Branch 10 → 12 not taken.
8 if (s && *str == *s && !memcmp (str + 1, s + 1, len - 1))
169 8 return s;
170 }
171 }
172 122 return 0;
173 }
174