Line | Source | Count |
1 | | - |
2 | | - |
3 | | - |
4 | struct field_range_pair *frp; | - |
5 | | - |
6 | | - |
7 | size_t n_frp; | - |
8 | | - |
9 | | - |
10 | static size_t n_frp_allocated; | - |
11 | static void | - |
12 | add_range_pair (uintmax_t lo, uintmax_t hi) | - |
13 | { | - |
14 | if (n_frp == n_frp_allocatedTRUE | evaluated 351 times by 2 tests | FALSE | evaluated 160 times by 2 tests |
) | 160-351 |
15 | frp = ((void) (!!sizeof (struct { _Static_assert (sizeof *(frp) != 1, "verify_true (" "sizeof *(frp) != 1" ")"); int _gl_dummy; })), x2nrealloc (frp, &n_frp_allocated, sizeof *(frp)));executed 351 times by 2 tests: frp = ((void) (!!sizeof (struct { _Static_assert (sizeof *(frp) != 1, "verify_true (" "sizeof *(frp) != 1" ")"); int _gl_dummy; })), x2nrealloc (frp, &n_frp_allocated, sizeof *(frp))); | 351 |
16 | frp[n_frp].lo = lo; | - |
17 | frp[n_frp].hi = hi; | - |
18 | ++n_frp; | - |
19 | }executed 511 times by 2 tests: end of block | 511 |
20 | | - |
21 | | - |
22 | | - |
23 | | - |
24 | static int | - |
25 | compare_ranges (const void *a, const void *b) | - |
26 | { | - |
27 | int a_start = ((const struct field_range_pair *) a)->lo; | - |
28 | int b_start = ((const struct field_range_pair *) b)->lo; | - |
29 | returnexecuted 175 times by 2 tests: return a_start < b_start ? -1 : a_start > b_start; a_start < b_start ? -1 : a_start > b_start;executed 175 times by 2 tests: return a_start < b_start ? -1 : a_start > b_start; | 175 |
30 | } | - |
31 | | - |
32 | | - |
33 | | - |
34 | | - |
35 | static void | - |
36 | complement_rp (void) | - |
37 | { | - |
38 | struct field_range_pair *c = frp; | - |
39 | size_t n = n_frp; | - |
40 | | - |
41 | frp = | - |
42 | ((void *)0) | - |
43 | ; | - |
44 | n_frp = 0; | - |
45 | n_frp_allocated = 0; | - |
46 | | - |
47 | if (c[0].lo > 1TRUE | evaluated 3 times by 1 test | FALSE | never evaluated |
) | 0-3 |
48 | add_range_pair (1, c[0].lo - 1);executed 3 times by 1 test: add_range_pair (1, c[0].lo - 1); | 3 |
49 | | - |
50 | for (size_t i = 1; i < nTRUE | never evaluated | FALSE | evaluated 3 times by 1 test |
; ++i) | 0-3 |
51 | { | - |
52 | if (c[i-1].hi + 1 == c[i].loTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
53 | continue; never executed: continue; | 0 |
54 | | - |
55 | add_range_pair (c[i-1].hi + 1, c[i].lo - 1); | - |
56 | } never executed: end of block | 0 |
57 | | - |
58 | if (c[n-1].hi < TRUE | never evaluated | FALSE | evaluated 3 times by 1 test |
| 0-3 |
59 | (18446744073709551615UL)TRUE | never evaluated | FALSE | evaluated 3 times by 1 test |
| 0-3 |
60 | ) | - |
61 | add_range_pair (c[n-1].hi + 1, never executed: add_range_pair (c[n-1].hi + 1, (18446744073709551615UL) ); | 0 |
62 | (18446744073709551615UL) never executed: add_range_pair (c[n-1].hi + 1, (18446744073709551615UL) ); | 0 |
63 | ); never executed: add_range_pair (c[n-1].hi + 1, (18446744073709551615UL) ); | 0 |
64 | | - |
65 | free (c); | - |
66 | }executed 3 times by 1 test: end of block | 3 |
67 | void | - |
68 | set_fields (const char *fieldstr, unsigned int options) | - |
69 | { | - |
70 | uintmax_t initial = 1; | - |
71 | uintmax_t value = 0; | - |
72 | | - |
73 | _Bool | - |
74 | lhs_specified = | - |
75 | 0 | - |
76 | ; | - |
77 | | - |
78 | _Bool | - |
79 | rhs_specified = | - |
80 | 0 | - |
81 | ; | - |
82 | | - |
83 | _Bool | - |
84 | dash_found = | - |
85 | 0 | - |
86 | ; | - |
87 | | - |
88 | | - |
89 | _Bool | - |
90 | in_digits = | - |
91 | 0 | - |
92 | ; | - |
93 | | - |
94 | | - |
95 | | - |
96 | | - |
97 | if ((TRUE | evaluated 52 times by 1 test | FALSE | evaluated 330 times by 1 test |
options & SETFLD_ALLOW_DASH)TRUE | evaluated 52 times by 1 test | FALSE | evaluated 330 times by 1 test |
&& (TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-330 |
98 | __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
99 | fieldstrTRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
100 | ) && __builtin_constant_p (TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
101 | "-"TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
102 | ) && (__s1_len = __builtin_strlen (TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
103 | fieldstrTRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
104 | ), __s2_len = __builtin_strlen (TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
105 | "-"TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
106 | ), (!((size_t)(const void *)((TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
107 | fieldstrTRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
108 | ) + 1) - (size_t)(const void *)(TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
109 | fieldstrTRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
110 | ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
111 | "-"TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
112 | ) + 1) - (size_t)(const void *)(TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
113 | "-"TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
114 | ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
115 | fieldstrTRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
116 | , TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
117 | "-"TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
118 | ) : (__builtin_constant_p (TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
119 | fieldstrTRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
120 | ) && ((size_t)(const void *)((TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
121 | fieldstrTRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
122 | ) + 1) - (size_t)(const void *)(TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
123 | fieldstrTRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
124 | ) == 1) && (__s1_len = __builtin_strlen (TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
125 | fieldstrTRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
126 | ), __s1_len < 4) ? (__builtin_constant_p (TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
127 | "-"TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
128 | ) && ((size_t)(const void *)((TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
129 | "-"TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
130 | ) + 1) - (size_t)(const void *)(TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
131 | "-"TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
132 | ) == 1) ? __builtin_strcmp (TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
133 | fieldstrTRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
134 | , TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
135 | "-"TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
136 | ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
137 | "-"TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
138 | ); int __result = (((const unsigned char *) (const char *) (TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
139 | fieldstrTRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
140 | ))[0] - __s2[0]); if (__s1_len > 0TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 0-50 |
141 | fieldstrTRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
142 | ))[1] - __s2[1]); if (__s1_len > 1TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 0-50 |
143 | fieldstrTRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
144 | ))[2] - __s2[2]); if (__s1_len > 2TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( fieldstr ))[3] - __s2[3]); TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 0-50 |
145 | fieldstrTRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( fieldstr ))[3] - __s2[3]); | 0-50 |
146 | ))[3] - __s2[3]);TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( fieldstr ))[3] - __s2[3]); }never executed: end of block }never executed: end of block __result; }))) : (__builtin_constant_p (TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 0-50 |
147 | "-"TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
148 | ) && ((size_t)(const void *)((TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
149 | "-"TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
150 | ) + 1) - (size_t)(const void *)(TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
151 | "-"TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
152 | ) == 1) && (__s2_len = __builtin_strlen (TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
153 | "-"TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
154 | ), __s2_len < 4) ? (__builtin_constant_p (TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
155 | fieldstrTRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
156 | ) && ((size_t)(const void *)((TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
157 | fieldstrTRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
158 | ) + 1) - (size_t)(const void *)(TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
159 | fieldstrTRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
160 | ) == 1) ? __builtin_strcmp (TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
161 | fieldstrTRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
162 | , TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
163 | "-"TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
164 | ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
165 | fieldstrTRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
166 | ); int __result = (((const unsigned char *) (const char *) (TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
167 | "-"TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
168 | ))[0] - __s2[0]); if (__s2_len > 0TRUE | evaluated 52 times by 1 test | FALSE | never evaluated |
&& __result == 0TRUE | evaluated 10 times by 1 test | FALSE | evaluated 42 times by 1 test |
) { __result = (((const unsigned char *) (const char *) (TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 0-52 |
169 | "-"TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
170 | ))[1] - __s2[1]); if (__s2_len > 1TRUE | never evaluated | FALSE | evaluated 10 times by 1 test |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 0-50 |
171 | "-"TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
172 | ))[2] - __s2[2]); if (__s2_len > 2TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( "-" ))[3] - __s2[3]); TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 0-50 |
173 | "-"TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( "-" ))[3] - __s2[3]); | 0-50 |
174 | ))[3] - __s2[3]);TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
never executed: __result = (((const unsigned char *) (const char *) ( "-" ))[3] - __s2[3]); }never executed: end of block } __result; }))) : __builtin_strcmp (TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 0-50 |
175 | fieldstrTRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
176 | , TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
177 | "-"TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
178 | )))); }) TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
| 2-50 |
179 | == 0)TRUE | evaluated 2 times by 1 test | FALSE | evaluated 50 times by 1 test |
) | 2-50 |
180 | { | - |
181 | value = 1; | - |
182 | lhs_specified = | - |
183 | 1 | - |
184 | ; | - |
185 | dash_found = | - |
186 | 1 | - |
187 | ; | - |
188 | fieldstr++; | - |
189 | }executed 2 times by 1 test: end of block | 2 |
190 | | - |
191 | while ( | - |
192 | 1 | - |
193 | ) | - |
194 | { | - |
195 | if (*TRUE | evaluated 303 times by 2 tests | FALSE | evaluated 1391 times by 2 tests |
fieldstr == '-'TRUE | evaluated 303 times by 2 tests | FALSE | evaluated 1391 times by 2 tests |
) | 303-1391 |
196 | { | - |
197 | in_digits = | - |
198 | 0 | - |
199 | ; | - |
200 | | - |
201 | if (dash_foundTRUE | evaluated 9 times by 2 tests | FALSE | evaluated 294 times by 2 tests |
) | 9-294 |
202 | do { error (0, 0, ((options & SETFLD_ERRMSG_USE_POS) ? | - |
203 | dcgettext (((void *)0), | - |
204 | "invalid byte or character range" | - |
205 | , 5) | - |
206 | : | - |
207 | dcgettext (((void *)0), | - |
208 | "invalid field range" | - |
209 | , 5) | - |
210 | )); usage ( | - |
211 | 1 | - |
212 | ); } never executed: end of block while (0) | 0 |
213 | | - |
214 | ; | - |
215 | | - |
216 | dash_found = | - |
217 | 1 | - |
218 | ; | - |
219 | fieldstr++; | - |
220 | | - |
221 | if (lhs_specifiedTRUE | evaluated 259 times by 2 tests | FALSE | evaluated 35 times by 2 tests |
&& !valueTRUE | evaluated 5 times by 2 tests | FALSE | evaluated 254 times by 2 tests |
) | 5-259 |
222 | do { error (0, 0, ((options & SETFLD_ERRMSG_USE_POS) ? | - |
223 | dcgettext (((void *)0), | - |
224 | "byte/character positions are numbered from 1" | - |
225 | , 5) | - |
226 | : | - |
227 | dcgettext (((void *)0), | - |
228 | "fields are numbered from 1" | - |
229 | , 5) | - |
230 | )); usage ( | - |
231 | 1 | - |
232 | ); } never executed: end of block while (0) | 0 |
233 | | - |
234 | ; | - |
235 | | - |
236 | initial = (lhs_specifiedTRUE | evaluated 254 times by 2 tests | FALSE | evaluated 35 times by 2 tests |
? value : 1); | 35-254 |
237 | value = 0; | - |
238 | }executed 289 times by 2 tests: end of block | 289 |
239 | else if (*TRUE | evaluated 171 times by 2 tests | FALSE | evaluated 1220 times by 2 tests |
fieldstr == ','TRUE | evaluated 171 times by 2 tests | FALSE | evaluated 1220 times by 2 tests |
| 171-1220 |
240 | || | - |
241 | ((*TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1219 times by 2 tests |
__ctype_b_loc ())[(int) ((TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1219 times by 2 tests |
| 1-1219 |
242 | to_uchar (*fieldstr)TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1219 times by 2 tests |
| 1-1219 |
243 | ))] & (unsigned short int) _ISblank)TRUE | evaluated 1 time by 1 test | FALSE | evaluated 1219 times by 2 tests |
| 1-1219 |
244 | || *TRUE | evaluated 363 times by 2 tests | FALSE | evaluated 856 times by 2 tests |
fieldstr == '\0'TRUE | evaluated 363 times by 2 tests | FALSE | evaluated 856 times by 2 tests |
) | 363-856 |
245 | { | - |
246 | in_digits = | - |
247 | 0 | - |
248 | ; | - |
249 | | - |
250 | if (dash_foundTRUE | evaluated 281 times by 2 tests | FALSE | evaluated 254 times by 2 tests |
) | 254-281 |
251 | { | - |
252 | dash_found = | - |
253 | 0 | - |
254 | ; | - |
255 | | - |
256 | if (!lhs_specifiedTRUE | evaluated 26 times by 2 tests | FALSE | evaluated 255 times by 2 tests |
&& !rhs_specifiedTRUE | evaluated 16 times by 2 tests | FALSE | evaluated 10 times by 2 tests |
) | 10-255 |
257 | { | - |
258 | | - |
259 | if (options & SETFLD_ALLOW_DASHTRUE | evaluated 1 time by 1 test | FALSE | evaluated 15 times by 1 test |
) | 1-15 |
260 | initial = 1;executed 1 time by 1 test: initial = 1; | 1 |
261 | else | - |
262 | do { error (0, 0, ( | - |
263 | dcgettext (((void *)0), | - |
264 | "invalid range with no endpoint: -" | - |
265 | , 5) | - |
266 | )); usage ( | - |
267 | 1 | - |
268 | ); } never executed: end of block while (0); | 0 |
269 | } | - |
270 | | - |
271 | | - |
272 | | - |
273 | if (!rhs_specifiedTRUE | evaluated 126 times by 2 tests | FALSE | evaluated 140 times by 2 tests |
) | 126-140 |
274 | { | - |
275 | | - |
276 | add_range_pair (initial, | - |
277 | (18446744073709551615UL) | - |
278 | ); | - |
279 | }executed 126 times by 2 tests: end of block | 126 |
280 | else | - |
281 | { | - |
282 | | - |
283 | if (value < initialTRUE | evaluated 4 times by 2 tests | FALSE | evaluated 136 times by 2 tests |
) | 4-136 |
284 | do { error (0, 0, ( | - |
285 | dcgettext (((void *)0), | - |
286 | "invalid decreasing range" | - |
287 | , 5) | - |
288 | )); usage ( | - |
289 | 1 | - |
290 | ); } never executed: end of block while (0); | 0 |
291 | | - |
292 | add_range_pair (initial, value); | - |
293 | }executed 136 times by 2 tests: end of block | 136 |
294 | value = 0; | - |
295 | }executed 262 times by 2 tests: end of block | 262 |
296 | else | - |
297 | { | - |
298 | | - |
299 | if (value == 0TRUE | evaluated 8 times by 2 tests | FALSE | evaluated 246 times by 2 tests |
) | 8-246 |
300 | do { error (0, 0, ((options & SETFLD_ERRMSG_USE_POS) ? | - |
301 | dcgettext (((void *)0), | - |
302 | "byte/character positions are numbered from 1" | - |
303 | , 5) | - |
304 | : | - |
305 | dcgettext (((void *)0), | - |
306 | "fields are numbered from 1" | - |
307 | , 5) | - |
308 | )); usage ( | - |
309 | 1 | - |
310 | ); } never executed: end of block while (0) | 0 |
311 | | - |
312 | ; | - |
313 | | - |
314 | add_range_pair (value, value); | - |
315 | value = 0; | - |
316 | }executed 246 times by 2 tests: end of block | 246 |
317 | | - |
318 | if (*TRUE | evaluated 336 times by 2 tests | FALSE | evaluated 172 times by 2 tests |
fieldstr == '\0'TRUE | evaluated 336 times by 2 tests | FALSE | evaluated 172 times by 2 tests |
) | 172-336 |
319 | break;executed 336 times by 2 tests: break; | 336 |
320 | | - |
321 | fieldstr++; | - |
322 | lhs_specified = | - |
323 | 0 | - |
324 | ; | - |
325 | rhs_specified = | - |
326 | 0 | - |
327 | ; | - |
328 | }executed 172 times by 2 tests: end of block | 172 |
329 | else if (((TRUE | evaluated 854 times by 2 tests | FALSE | evaluated 2 times by 1 test |
unsigned int) (*fieldstr) - '0' <= 9)TRUE | evaluated 854 times by 2 tests | FALSE | evaluated 2 times by 1 test |
) | 2-854 |
330 | { | - |
331 | | - |
332 | | - |
333 | static char const *num_start; | - |
334 | if (!in_digitsTRUE | evaluated 651 times by 2 tests | FALSE | evaluated 203 times by 2 tests |
|| !num_startTRUE | never evaluated | FALSE | evaluated 203 times by 2 tests |
) | 0-651 |
335 | num_start = fieldstr;executed 651 times by 2 tests: num_start = fieldstr; | 651 |
336 | in_digits = | - |
337 | 1 | - |
338 | ; | - |
339 | | - |
340 | if (dash_foundTRUE | evaluated 160 times by 2 tests | FALSE | evaluated 694 times by 2 tests |
) | 160-694 |
341 | rhs_specified = 1;executed 160 times by 2 tests: rhs_specified = 1; | 160 |
342 | else | - |
343 | lhs_specified = 1;executed 694 times by 2 tests: lhs_specified = 1; | 694 |
344 | | - |
345 | | - |
346 | if (!( (void) (&(value) == (uintmax_t *) TRUE | evaluated 1 time by 1 test | FALSE | evaluated 853 times by 2 tests |
| 1-853 |
347 | ((void *)0)TRUE | evaluated 1 time by 1 test | FALSE | evaluated 853 times by 2 tests |
| 1-853 |
348 | ), (void) (!!sizeof (struct { _Static_assert (! (! ((uintmax_t) 0 < (uintmax_t) -1)), "verify_true (" "! TYPE_SIGNED (uintmax_t)" ")"); int _gl_dummy; })), (void) (!!sizeof (struct { _Static_assert (sizeof (value) == sizeof (uintmax_t), "verify_true (" "sizeof (value) == sizeof (uintmax_t)" ")"); int _gl_dummy; })), (((TRUE | never evaluated | FALSE | evaluated 854 times by 2 tests |
uintmax_t) -1 / 10 < (value)TRUE | never evaluated | FALSE | evaluated 854 times by 2 tests |
|| (TRUE | evaluated 1 time by 1 test | FALSE | evaluated 853 times by 2 tests |
uintmax_t) ((value) * 10 + (*fieldstr - '0')) < (value)TRUE | evaluated 1 time by 1 test | FALSE | evaluated 853 times by 2 tests |
) ? TRUE | evaluated 1 time by 1 test | FALSE | evaluated 853 times by 2 tests |
| 0-854 |
349 | 0 TRUE | evaluated 1 time by 1 test | FALSE | evaluated 853 times by 2 tests |
| 1-853 |
350 | : (((value) = (value) * 10 + (*fieldstr - '0')), TRUE | evaluated 1 time by 1 test | FALSE | evaluated 853 times by 2 tests |
| 1-853 |
351 | 1TRUE | evaluated 1 time by 1 test | FALSE | evaluated 853 times by 2 tests |
| 1-853 |
352 | )) )TRUE | evaluated 1 time by 1 test | FALSE | evaluated 853 times by 2 tests |
| 1-853 |
353 | || value == TRUE | evaluated 2 times by 2 tests | FALSE | evaluated 851 times by 2 tests |
| 2-851 |
354 | (18446744073709551615UL)TRUE | evaluated 2 times by 2 tests | FALSE | evaluated 851 times by 2 tests |
| 2-851 |
355 | ) | - |
356 | { | - |
357 | | - |
358 | | - |
359 | | - |
360 | size_t len = | - |
361 | __builtin_strspn ( | - |
362 | num_start | - |
363 | , | - |
364 | "0123456789" | - |
365 | ) | - |
366 | ; | - |
367 | char *bad_num = xstrndup (num_start, len); | - |
368 | error (0, 0, (options & SETFLD_ERRMSG_USE_POS) | - |
369 | ? | - |
370 | dcgettext (((void *)0), | - |
371 | "byte/character offset %s is too large" | - |
372 | , 5) | - |
373 | | - |
374 | : | - |
375 | dcgettext (((void *)0), | - |
376 | "field number %s is too large" | - |
377 | , 5) | - |
378 | , | - |
379 | quote (bad_num)); | - |
380 | free (bad_num); | - |
381 | usage ( | - |
382 | 1 | - |
383 | ); | - |
384 | } never executed: end of block | 0 |
385 | | - |
386 | fieldstr++; | - |
387 | }executed 851 times by 2 tests: end of block | 851 |
388 | else | - |
389 | { | - |
390 | error (0, 0, (options & SETFLD_ERRMSG_USE_POS) | - |
391 | ? | - |
392 | dcgettext (((void *)0), | - |
393 | "invalid byte/character position %s" | - |
394 | , 5) | - |
395 | | - |
396 | : | - |
397 | dcgettext (((void *)0), | - |
398 | "invalid field value %s" | - |
399 | , 5) | - |
400 | , | - |
401 | quote (fieldstr)); | - |
402 | usage ( | - |
403 | 1 | - |
404 | ); | - |
405 | } never executed: end of block | 0 |
406 | } | - |
407 | | - |
408 | if (!n_frpTRUE | never evaluated | FALSE | evaluated 336 times by 2 tests |
) | 0-336 |
409 | do { error (0, 0, ((options&SETFLD_ERRMSG_USE_POS) ? | - |
410 | dcgettext (((void *)0), | - |
411 | "missing list of byte/character positions" | - |
412 | , 5) | - |
413 | : | - |
414 | dcgettext (((void *)0), | - |
415 | "missing list of fields" | - |
416 | , 5) | - |
417 | )); usage ( | - |
418 | 1 | - |
419 | ); } never executed: end of block while (0) | 0 |
420 | | - |
421 | ; | - |
422 | | - |
423 | qsort (frp, n_frp, sizeof (frp[0]), compare_ranges); | - |
424 | | - |
425 | | - |
426 | for (size_t i = 0; i < n_frpTRUE | evaluated 423 times by 2 tests | FALSE | evaluated 336 times by 2 tests |
; ++i) | 336-423 |
427 | { | - |
428 | for (size_t j = i + 1; j < n_frpTRUE | evaluated 160 times by 2 tests | FALSE | evaluated 336 times by 2 tests |
; ++j) | 160-336 |
429 | { | - |
430 | if (frp[j].lo <= frp[i].hiTRUE | evaluated 73 times by 2 tests | FALSE | evaluated 87 times by 2 tests |
) | 73-87 |
431 | { | - |
432 | frp[i].hi = | - |
433 | (((TRUE | evaluated 25 times by 2 tests | FALSE | evaluated 48 times by 2 tests |
| 25-48 |
434 | frp[j].hiTRUE | evaluated 25 times by 2 tests | FALSE | evaluated 48 times by 2 tests |
| 25-48 |
435 | )>(TRUE | evaluated 25 times by 2 tests | FALSE | evaluated 48 times by 2 tests |
| 25-48 |
436 | frp[i].hiTRUE | evaluated 25 times by 2 tests | FALSE | evaluated 48 times by 2 tests |
| 25-48 |
437 | ))TRUE | evaluated 25 times by 2 tests | FALSE | evaluated 48 times by 2 tests |
?( | 25-48 |
438 | frp[j].hi | - |
439 | ):( | - |
440 | frp[i].hi | - |
441 | )) | - |
442 | ; | - |
443 | memmove (frp + j, frp + j + 1, (n_frp - j - 1) * sizeof *frp); | - |
444 | n_frp--; | - |
445 | j--; | - |
446 | }executed 73 times by 2 tests: end of block | 73 |
447 | else | - |
448 | break;executed 87 times by 2 tests: break; | 87 |
449 | } | - |
450 | }executed 423 times by 2 tests: end of block | 423 |
451 | | - |
452 | if (options & SETFLD_COMPLEMENTTRUE | evaluated 3 times by 1 test | FALSE | evaluated 333 times by 2 tests |
) | 3-333 |
453 | complement_rp ();executed 3 times by 1 test: complement_rp (); | 3 |
454 | | - |
455 | | - |
456 | | - |
457 | | - |
458 | ++n_frp; | - |
459 | frp = xrealloc (frp, n_frp * sizeof (struct field_range_pair)); | - |
460 | frp[n_frp - 1].lo = frp[n_frp - 1].hi = | - |
461 | (18446744073709551615UL) | - |
462 | ; | - |
463 | }executed 336 times by 2 tests: end of block | 336 |
464 | | - |
465 | void | - |
466 | reset_fields (void) | - |
467 | { | - |
468 | n_frp = 0 ; | - |
469 | n_frp_allocated = 0; | - |
470 | free (frp); | - |
471 | frp = | - |
472 | ((void *)0) | - |
473 | ; | - |
474 | } never executed: end of block | 0 |
| | |