OpenCoverage

hash.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/coreutils/src/gnulib/lib/hash.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6struct hash_entry-
7 {-
8 void *data;-
9 struct hash_entry *next;-
10 };-
11-
12struct hash_table-
13 {-
14-
15-
16-
17 struct hash_entry *bucket;-
18 struct hash_entry const *bucket_limit;-
19 size_t n_buckets;-
20 size_t n_buckets_used;-
21 size_t n_entries;-
22-
23-
24 const Hash_tuning *tuning;-
25-
26-
27-
28-
29-
30-
31 Hash_hasher hasher;-
32 Hash_comparator comparator;-
33 Hash_data_freer data_freer;-
34-
35-
36 struct hash_entry *free_entry_list;-
37-
38-
39-
40-
41-
42-
43-
44 };-
45static const Hash_tuning default_tuning =-
46 {-
47 0.0f,-
48 1.0f,-
49 0.8f,-
50 1.414f,-
51 -
52 0-
53 -
54 };-
55size_t-
56hash_get_n_buckets (const Hash_table *table)-
57{-
58 return
never executed: return table->n_buckets;
table->n_buckets;
never executed: return table->n_buckets;
0
59}-
60-
61-
62-
63size_t-
64hash_get_n_buckets_used (const Hash_table *table)-
65{-
66 return
never executed: return table->n_buckets_used;
table->n_buckets_used;
never executed: return table->n_buckets_used;
0
67}-
68-
69-
70-
71size_t-
72hash_get_n_entries (const Hash_table *table)-
73{-
74 return
executed 13 times by 2 tests: return table->n_entries;
Executed by:
  • ls
  • tail
table->n_entries;
executed 13 times by 2 tests: return table->n_entries;
Executed by:
  • ls
  • tail
13
75}-
76-
77-
78-
79size_t-
80hash_get_max_bucket_length (const Hash_table *table)-
81{-
82 struct hash_entry const *bucket;-
83 size_t max_bucket_length = 0;-
84-
85 for (bucket = table->bucket; bucket < table->bucket_limit
bucket < table->bucket_limitDescription
TRUEnever evaluated
FALSEnever evaluated
; bucket++)
0
86 {-
87 if (bucket->data
bucket->dataDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
88 {-
89 struct hash_entry const *cursor = bucket;-
90 size_t bucket_length = 1;-
91-
92 while (cursor = cursor->next, cursor
cursor = cursor->next, cursorDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
93 bucket_length++;
never executed: bucket_length++;
0
94-
95 if (bucket_length > max_bucket_length
bucket_length ..._bucket_lengthDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
96 max_bucket_length = bucket_length;
never executed: max_bucket_length = bucket_length;
0
97 }
never executed: end of block
0
98 }
never executed: end of block
0
99-
100 return
never executed: return max_bucket_length;
max_bucket_length;
never executed: return max_bucket_length;
0
101}-
102-
103-
104-
105-
106-
107_Bool-
108-
109hash_table_ok (const Hash_table *table)-
110{-
111 struct hash_entry const *bucket;-
112 size_t n_buckets_used = 0;-
113 size_t n_entries = 0;-
114-
115 for (bucket = table->bucket; bucket < table->bucket_limit
bucket < table->bucket_limitDescription
TRUEnever evaluated
FALSEnever evaluated
; bucket++)
0
116 {-
117 if (bucket->data
bucket->dataDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
118 {-
119 struct hash_entry const *cursor = bucket;-
120-
121-
122 n_buckets_used++;-
123 n_entries++;-
124-
125-
126 while (cursor = cursor->next, cursor
cursor = cursor->next, cursorDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
127 n_entries++;
never executed: n_entries++;
0
128 }
never executed: end of block
0
129 }
never executed: end of block
0
130-
131 if (n_buckets_used == table->n_buckets_used
n_buckets_used...n_buckets_usedDescription
TRUEnever evaluated
FALSEnever evaluated
&& n_entries == table->n_entries
n_entries == table->n_entriesDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
132 return
never executed: return 1 ;
never executed: return 1 ;
0
133 1
never executed: return 1 ;
0
134 ;
never executed: return 1 ;
0
135-
136 return
never executed: return 0 ;
never executed: return 0 ;
0
137 0
never executed: return 0 ;
0
138 ;
never executed: return 0 ;
0
139}-
140-
141void-
142hash_print_statistics (const Hash_table *table, FILE *stream)-
143{-
144 size_t n_entries = hash_get_n_entries (table);-
145 size_t n_buckets = hash_get_n_buckets (table);-
146 size_t n_buckets_used = hash_get_n_buckets_used (table);-
147 size_t max_bucket_length = hash_get_max_bucket_length (table);-
148-
149 fprintf (stream, "# entries: %lu\n", (unsigned long int) n_entries);-
150 fprintf (stream, "# buckets: %lu\n", (unsigned long int) n_buckets);-
151 fprintf (stream, "# buckets used: %lu (%.2f%%)\n",-
152 (unsigned long int) n_buckets_used,-
153 (100.0 * n_buckets_used) / n_buckets);-
154 fprintf (stream, "max bucket length: %lu\n",-
155 (unsigned long int) max_bucket_length);-
156}
never executed: end of block
0
157-
158-
159-
160static struct hash_entry *-
161safe_hasher (const Hash_table *table, const void *key)-
162{-
163 size_t n = table->hasher (key, table->n_buckets);-
164 if (! (n < table->n_buckets)
! (n < table->n_buckets)Description
TRUEnever evaluated
FALSEevaluated 99761 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
)
0-99761
165 abort ();
never executed: abort ();
0
166 return
executed 99761 times by 16 tests: return table->bucket + n;
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
table->bucket + n;
executed 99761 times by 16 tests: return table->bucket + n;
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
99761
167}-
168-
169-
170-
171-
172void *-
173hash_lookup (const Hash_table *table, const void *entry)-
174{-
175 struct hash_entry const *bucket = safe_hasher (table, entry);-
176 struct hash_entry const *cursor;-
177-
178 if (bucket->data ==
bucket->data == ((void *)0)Description
TRUEevaluated 37175 times by 12 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ln
  • mv
  • readlink
  • realpath
  • rm
  • tail
FALSEevaluated 3218 times by 9 tests
Evaluated by:
  • chmod
  • cp
  • df
  • du
  • ln
  • mv
  • readlink
  • rm
  • tail
3218-37175
179 ((void *)0)
bucket->data == ((void *)0)Description
TRUEevaluated 37175 times by 12 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ln
  • mv
  • readlink
  • realpath
  • rm
  • tail
FALSEevaluated 3218 times by 9 tests
Evaluated by:
  • chmod
  • cp
  • df
  • du
  • ln
  • mv
  • readlink
  • rm
  • tail
3218-37175
180 )-
181 return
executed 37175 times by 12 tests: return ((void *)0) ;
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ln
  • mv
  • readlink
  • realpath
  • rm
  • tail
executed 37175 times by 12 tests: return ((void *)0) ;
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ln
  • mv
  • readlink
  • realpath
  • rm
  • tail
37175
182 ((void *)0)
executed 37175 times by 12 tests: return ((void *)0) ;
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ln
  • mv
  • readlink
  • realpath
  • rm
  • tail
37175
183 ;
executed 37175 times by 12 tests: return ((void *)0) ;
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ln
  • mv
  • readlink
  • realpath
  • rm
  • tail
37175
184-
185 for (cursor = bucket; cursor
cursorDescription
TRUEevaluated 4575 times by 9 tests
Evaluated by:
  • chmod
  • cp
  • df
  • du
  • ln
  • mv
  • readlink
  • rm
  • tail
FALSEevaluated 2579 times by 5 tests
Evaluated by:
  • cp
  • df
  • du
  • mv
  • readlink
; cursor = cursor->next)
2579-4575
186 if (entry == cursor->data
entry == cursor->dataDescription
TRUEnever evaluated
FALSEevaluated 4575 times by 9 tests
Evaluated by:
  • chmod
  • cp
  • df
  • du
  • ln
  • mv
  • readlink
  • rm
  • tail
|| table->comparator (entry, cursor->data)
table->compara... cursor->data)Description
TRUEevaluated 639 times by 9 tests
Evaluated by:
  • chmod
  • cp
  • df
  • du
  • ln
  • mv
  • readlink
  • rm
  • tail
FALSEevaluated 3936 times by 5 tests
Evaluated by:
  • cp
  • df
  • du
  • mv
  • readlink
)
0-4575
187 return
executed 639 times by 9 tests: return cursor->data;
Executed by:
  • chmod
  • cp
  • df
  • du
  • ln
  • mv
  • readlink
  • rm
  • tail
cursor->data;
executed 639 times by 9 tests: return cursor->data;
Executed by:
  • chmod
  • cp
  • df
  • du
  • ln
  • mv
  • readlink
  • rm
  • tail
639
188-
189 return
executed 2579 times by 5 tests: return ((void *)0) ;
Executed by:
  • cp
  • df
  • du
  • mv
  • readlink
executed 2579 times by 5 tests: return ((void *)0) ;
Executed by:
  • cp
  • df
  • du
  • mv
  • readlink
2579
190 ((void *)0)
executed 2579 times by 5 tests: return ((void *)0) ;
Executed by:
  • cp
  • df
  • du
  • mv
  • readlink
2579
191 ;
executed 2579 times by 5 tests: return ((void *)0) ;
Executed by:
  • cp
  • df
  • du
  • mv
  • readlink
2579
192}-
193void *-
194hash_get_first (const Hash_table *table)-
195{-
196 struct hash_entry const *bucket;-
197-
198 if (table->n_entries == 0
table->n_entries == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
199 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
200 ((void *)0)
never executed: return ((void *)0) ;
0
201 ;
never executed: return ((void *)0) ;
0
202-
203 for (bucket = table->bucket; ; bucket++)-
204 if (! (bucket < table->bucket_limit)
! (bucket < ta...>bucket_limit)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
205 abort ();
never executed: abort ();
0
206 else if (bucket->data
bucket->dataDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
207 return
never executed: return bucket->data;
bucket->data;
never executed: return bucket->data;
0
208}
never executed: end of block
0
209-
210-
211-
212-
213-
214void *-
215hash_get_next (const Hash_table *table, const void *entry)-
216{-
217 struct hash_entry const *bucket = safe_hasher (table, entry);-
218 struct hash_entry const *cursor;-
219-
220-
221 cursor = bucket;-
222 do-
223 {-
224 if (cursor->data == entry
cursor->data == entryDescription
TRUEnever evaluated
FALSEnever evaluated
&& cursor->next
cursor->nextDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
225 return
never executed: return cursor->next->data;
cursor->next->data;
never executed: return cursor->next->data;
0
226 cursor = cursor->next;-
227 }
never executed: end of block
0
228 while (cursor !=
cursor != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
229 ((void *)0)
cursor != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
230 );-
231-
232-
233 while (++
++bucket < table->bucket_limitDescription
TRUEnever evaluated
FALSEnever evaluated
bucket < table->bucket_limit
++bucket < table->bucket_limitDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
234 if (bucket->data
bucket->dataDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
235 return
never executed: return bucket->data;
bucket->data;
never executed: return bucket->data;
0
236-
237-
238 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
239 ((void *)0)
never executed: return ((void *)0) ;
0
240 ;
never executed: return ((void *)0) ;
0
241}-
242-
243-
244-
245-
246-
247size_t-
248hash_get_entries (const Hash_table *table, void **buffer,-
249 size_t buffer_size)-
250{-
251 size_t counter = 0;-
252 struct hash_entry const *bucket;-
253 struct hash_entry const *cursor;-
254-
255 for (bucket = table->bucket; bucket < table->bucket_limit
bucket < table->bucket_limitDescription
TRUEnever evaluated
FALSEnever evaluated
; bucket++)
0
256 {-
257 if (bucket->data
bucket->dataDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
258 {-
259 for (cursor = bucket; cursor
cursorDescription
TRUEnever evaluated
FALSEnever evaluated
; cursor = cursor->next)
0
260 {-
261 if (counter >= buffer_size
counter >= buffer_sizeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
262 return
never executed: return counter;
counter;
never executed: return counter;
0
263 buffer[counter++] = cursor->data;-
264 }
never executed: end of block
0
265 }
never executed: end of block
0
266 }
never executed: end of block
0
267-
268 return
never executed: return counter;
counter;
never executed: return counter;
0
269}-
270size_t-
271hash_do_for_each (const Hash_table *table, Hash_processor processor,-
272 void *processor_data)-
273{-
274 size_t counter = 0;-
275 struct hash_entry const *bucket;-
276 struct hash_entry const *cursor;-
277-
278 for (bucket = table->bucket; bucket < table->bucket_limit
bucket < table->bucket_limitDescription
TRUEnever evaluated
FALSEnever evaluated
; bucket++)
0
279 {-
280 if (bucket->data
bucket->dataDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
281 {-
282 for (cursor = bucket; cursor
cursorDescription
TRUEnever evaluated
FALSEnever evaluated
; cursor = cursor->next)
0
283 {-
284 if (! processor (cursor->data, processor_data)
! processor (c...rocessor_data)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
285 return
never executed: return counter;
counter;
never executed: return counter;
0
286 counter++;-
287 }
never executed: end of block
0
288 }
never executed: end of block
0
289 }
never executed: end of block
0
290-
291 return
never executed: return counter;
counter;
never executed: return counter;
0
292}-
293size_t-
294hash_string (const char *string, size_t n_buckets)-
295{-
296 size_t value = 0;-
297 unsigned char ch;-
298-
299 for (; (
(ch = *string)Description
TRUEevaluated 307 times by 1 test
Evaluated by:
  • du
FALSEevaluated 90 times by 1 test
Evaluated by:
  • du
ch = *string)
(ch = *string)Description
TRUEevaluated 307 times by 1 test
Evaluated by:
  • du
FALSEevaluated 90 times by 1 test
Evaluated by:
  • du
; string++)
90-307
300 value = (value * 31 + ch) % n_buckets;
executed 307 times by 1 test: value = (value * 31 + ch) % n_buckets;
Executed by:
  • du
307
301 return
executed 90 times by 1 test: return value;
Executed by:
  • du
value;
executed 90 times by 1 test: return value;
Executed by:
  • du
90
302}-
303-
304-
305-
306-
307-
308-
309static -
310 _Bool -
311 __attribute__ ((__const__))-
312is_prime (size_t candidate)-
313{-
314 size_t divisor = 3;-
315 size_t square = divisor * divisor;-
316-
317 while (square < candidate
square < candidateDescription
TRUEevaluated 15862 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
FALSEevaluated 6754 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
&& (
(candidate % divisor)Description
TRUEevaluated 13839 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
FALSEevaluated 2023 times by 9 tests
Evaluated by:
  • chgrp
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • mv
  • readlink
candidate % divisor)
(candidate % divisor)Description
TRUEevaluated 13839 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
FALSEevaluated 2023 times by 9 tests
Evaluated by:
  • chgrp
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • mv
  • readlink
)
2023-15862
318 {-
319 divisor++;-
320 square += 4 * divisor;-
321 divisor++;-
322 }
executed 13839 times by 16 tests: end of block
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
13839
323-
324 return
executed 8777 times by 16 tests: return (candidate % divisor ? 1 : 0 );
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
(candidate % divisor ?
executed 8777 times by 16 tests: return (candidate % divisor ? 1 : 0 );
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
8777
325 1
executed 8777 times by 16 tests: return (candidate % divisor ? 1 : 0 );
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
8777
326 :
executed 8777 times by 16 tests: return (candidate % divisor ? 1 : 0 );
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
8777
327 0
executed 8777 times by 16 tests: return (candidate % divisor ? 1 : 0 );
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
8777
328 );
executed 8777 times by 16 tests: return (candidate % divisor ? 1 : 0 );
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
8777
329}-
330-
331-
332-
333-
334static size_t __attribute__ ((__const__))-
335next_prime (size_t candidate)-
336{-
337-
338 if (candidate < 10
candidate < 10Description
TRUEevaluated 215 times by 6 tests
Evaluated by:
  • du
  • ln
  • readlink
  • realpath
  • shuf
  • tail
FALSEevaluated 6539 times by 14 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • rm
  • sort
  • tail
)
215-6539
339 candidate = 10;
executed 215 times by 6 tests: candidate = 10;
Executed by:
  • du
  • ln
  • readlink
  • realpath
  • shuf
  • tail
215
340-
341-
342 candidate |= 1;-
343-
344 while (-
345 (
(1844674407370...) != candidateDescription
TRUEevaluated 8777 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
FALSEnever evaluated
18446744073709551615UL)
(1844674407370...) != candidateDescription
TRUEevaluated 8777 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
FALSEnever evaluated
0-8777
346 != candidate
(1844674407370...) != candidateDescription
TRUEevaluated 8777 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
FALSEnever evaluated
&& !is_prime (candidate)
!is_prime (candidate)Description
TRUEevaluated 2023 times by 9 tests
Evaluated by:
  • chgrp
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • mv
  • readlink
FALSEevaluated 6754 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
)
0-8777
347 candidate += 2;
executed 2023 times by 9 tests: candidate += 2;
Executed by:
  • chgrp
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • mv
  • readlink
2023
348-
349 return
executed 6754 times by 16 tests: return candidate;
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
candidate;
executed 6754 times by 16 tests: return candidate;
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
6754
350}-
351-
352void-
353hash_reset_tuning (Hash_tuning *tuning)-
354{-
355 *tuning = default_tuning;-
356}
never executed: end of block
0
357-
358-
359static size_t-
360raw_hasher (const void *data, size_t n)-
361{-
362-
363-
364-
365-
366-
367 size_t val = rotr_sz ((size_t) data, 3);-
368 return
never executed: return val % n;
val % n;
never executed: return val % n;
0
369}-
370-
371-
372static -
373 _Bool-
374-
375raw_comparator (const void *a, const void *b)-
376{-
377 return
executed 316 times by 1 test: return a == b;
Executed by:
  • du
a == b;
executed 316 times by 1 test: return a == b;
Executed by:
  • du
316
378}-
379static -
380 _Bool-
381-
382check_tuning (Hash_table *table)-
383{-
384 const Hash_tuning *tuning = table->tuning;-
385 float epsilon;-
386 if (tuning == &default_tuning
tuning == &default_tuningDescription
TRUEevaluated 6754 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
FALSEnever evaluated
)
0-6754
387 return
executed 6754 times by 16 tests: return 1 ;
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
executed 6754 times by 16 tests: return 1 ;
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
6754
388 1
executed 6754 times by 16 tests: return 1 ;
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
6754
389 ;
executed 6754 times by 16 tests: return 1 ;
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
6754
390-
391-
392-
393-
394-
395-
396 epsilon = 0.1f;-
397-
398 if (epsilon < tuning->growth_threshold
epsilon < tuni...owth_thresholdDescription
TRUEnever evaluated
FALSEnever evaluated
0
399 && tuning->growth_threshold < 1 - epsilon
tuning->growth... < 1 - epsilonDescription
TRUEnever evaluated
FALSEnever evaluated
0
400 && 1 + epsilon < tuning->growth_factor
1 + epsilon < ...>growth_factorDescription
TRUEnever evaluated
FALSEnever evaluated
0
401 && 0 <= tuning->shrink_threshold
0 <= tuning->shrink_thresholdDescription
TRUEnever evaluated
FALSEnever evaluated
0
402 && tuning->shrink_threshold + epsilon < tuning->shrink_factor
tuning->shrink...>shrink_factorDescription
TRUEnever evaluated
FALSEnever evaluated
0
403 && tuning->shrink_factor <= 1
tuning->shrink_factor <= 1Description
TRUEnever evaluated
FALSEnever evaluated
0
404 && tuning->shrink_threshold + epsilon < tuning->growth_threshold
tuning->shrink...owth_thresholdDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
405 return
never executed: return 1 ;
never executed: return 1 ;
0
406 1
never executed: return 1 ;
0
407 ;
never executed: return 1 ;
0
408-
409 table->tuning = &default_tuning;-
410 return
never executed: return 0 ;
never executed: return 0 ;
0
411 0
never executed: return 0 ;
0
412 ;
never executed: return 0 ;
0
413}-
414-
415-
416-
417-
418-
419static size_t -
420 __attribute__ ((__pure__))-
421-
422compute_bucket_size (size_t candidate, const Hash_tuning *tuning)-
423{-
424 if (!tuning->is_n_buckets
!tuning->is_n_bucketsDescription
TRUEevaluated 6754 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
FALSEnever evaluated
)
0-6754
425 {-
426 float new_candidate = candidate / tuning->growth_threshold;-
427 if (-
428 (
(1844674407370... new_candidateDescription
TRUEnever evaluated
FALSEevaluated 6754 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
18446744073709551615UL)
(1844674407370... new_candidateDescription
TRUEnever evaluated
FALSEevaluated 6754 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
0-6754
429 <= new_candidate
(1844674407370... new_candidateDescription
TRUEnever evaluated
FALSEevaluated 6754 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
)
0-6754
430 return
never executed: return 0;
0;
never executed: return 0;
0
431 candidate = new_candidate;-
432 }
executed 6754 times by 16 tests: end of block
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
6754
433 candidate = next_prime (candidate);-
434 if ((
(__builtin_con...oc_count); }))Description
TRUEnever evaluated
FALSEevaluated 6754 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
__builtin_constant_p (candidate)
__builtin_cons..._p (candidate)Description
TRUEnever evaluated
FALSEevaluated 6754 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
&& __builtin_constant_p (sizeof (struct hash_entry *))
__builtin_cons...hash_entry *))Description
TRUEnever evaluated
FALSEnever evaluated
? ((size_t) (
(__builtin_con...oc_count); }))Description
TRUEnever evaluated
FALSEevaluated 6754 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
0-6754
435 (9223372036854775807L)
(__builtin_con...oc_count); }))Description
TRUEnever evaluated
FALSEevaluated 6754 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
0-6754
436 <
(__builtin_con...oc_count); }))Description
TRUEnever evaluated
FALSEevaluated 6754 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
0-6754
437 (18446744073709551615UL)
(__builtin_con...oc_count); }))Description
TRUEnever evaluated
FALSEevaluated 6754 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
0-6754
438 ?
(__builtin_con...oc_count); }))Description
TRUEnever evaluated
FALSEevaluated 6754 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
0-6754
439 (9223372036854775807L)
(__builtin_con...oc_count); }))Description
TRUEnever evaluated
FALSEevaluated 6754 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
0-6754
440 :
(__builtin_con...oc_count); }))Description
TRUEnever evaluated
FALSEevaluated 6754 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
0-6754
441 (18446744073709551615UL)
(__builtin_con...oc_count); }))Description
TRUEnever evaluated
FALSEevaluated 6754 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
0-6754
442 - 1) / (sizeof (struct hash_entry *)) < (candidate)) : ({ __xalloc_count_type __xalloc_count; __builtin_mul_overflow (candidate, sizeof (struct hash_entry *), &__xalloc_count); }))
(__builtin_con...oc_count); }))Description
TRUEnever evaluated
FALSEevaluated 6754 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
)
0-6754
443 return
never executed: return 0;
0;
never executed: return 0;
0
444 return
executed 6754 times by 16 tests: return candidate;
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
candidate;
executed 6754 times by 16 tests: return candidate;
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
6754
445}-
446Hash_table *-
447hash_initialize (size_t candidate, const Hash_tuning *tuning,-
448 Hash_hasher hasher, Hash_comparator comparator,-
449 Hash_data_freer data_freer)-
450{-
451 Hash_table *table;-
452-
453 if (hasher ==
hasher == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 6728 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
0-6728
454 ((void *)0)
hasher == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 6728 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
0-6728
455 )-
456 hasher = raw_hasher;
never executed: hasher = raw_hasher;
0
457 if (comparator ==
comparator == ((void *)0)Description
TRUEevaluated 27 times by 1 test
Evaluated by:
  • du
FALSEevaluated 6701 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
27-6701
458 ((void *)0)
comparator == ((void *)0)Description
TRUEevaluated 27 times by 1 test
Evaluated by:
  • du
FALSEevaluated 6701 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
27-6701
459 )-
460 comparator = raw_comparator;
executed 27 times by 1 test: comparator = raw_comparator;
Executed by:
  • du
27
461-
462 table = malloc (sizeof *table);-
463 if (table ==
table == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 6728 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
0-6728
464 ((void *)0)
table == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 6728 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
0-6728
465 )-
466 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
467 ((void *)0)
never executed: return ((void *)0) ;
0
468 ;
never executed: return ((void *)0) ;
0
469-
470 if (!tuning
!tuningDescription
TRUEevaluated 6728 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
FALSEnever evaluated
)
0-6728
471 tuning = &default_tuning;
executed 6728 times by 16 tests: tuning = &default_tuning;
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
6728
472 table->tuning = tuning;-
473 if (!check_tuning (table)
!check_tuning (table)Description
TRUEnever evaluated
FALSEevaluated 6728 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
)
0-6728
474 {-
475-
476-
477-
478-
479-
480 goto
never executed: goto fail;
fail;
never executed: goto fail;
0
481 }-
482-
483 table->n_buckets = compute_bucket_size (candidate, tuning);-
484 if (!table->n_buckets
!table->n_bucketsDescription
TRUEnever evaluated
FALSEevaluated 6728 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
)
0-6728
485 goto
never executed: goto fail;
fail;
never executed: goto fail;
0
486-
487 table->bucket = calloc (table->n_buckets, sizeof *table->bucket);-
488 if (table->bucket ==
table->bucket == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 6728 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
0-6728
489 ((void *)0)
table->bucket == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 6728 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
0-6728
490 )-
491 goto
never executed: goto fail;
fail;
never executed: goto fail;
0
492 table->bucket_limit = table->bucket + table->n_buckets;-
493 table->n_buckets_used = 0;-
494 table->n_entries = 0;-
495-
496 table->hasher = hasher;-
497 table->comparator = comparator;-
498 table->data_freer = data_freer;-
499-
500 table->free_entry_list = -
501 ((void *)0)-
502 ;-
503-
504-
505-
506 return
executed 6728 times by 16 tests: return table;
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
table;
executed 6728 times by 16 tests: return table;
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
6728
507-
508 fail:-
509 free (table);-
510 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
511 ((void *)0)
never executed: return ((void *)0) ;
0
512 ;
never executed: return ((void *)0) ;
0
513}-
514-
515-
516-
517-
518-
519void-
520hash_clear (Hash_table *table)-
521{-
522 struct hash_entry *bucket;-
523-
524 for (bucket = table->bucket; bucket < table->bucket_limit
bucket < table->bucket_limitDescription
TRUEnever evaluated
FALSEnever evaluated
; bucket++)
0
525 {-
526 if (bucket->data
bucket->dataDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
527 {-
528 struct hash_entry *cursor;-
529 struct hash_entry *next;-
530-
531-
532 for (cursor = bucket->next; cursor
cursorDescription
TRUEnever evaluated
FALSEnever evaluated
; cursor = next)
0
533 {-
534 if (table->data_freer
table->data_freerDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
535 table->data_freer (cursor->data);
never executed: table->data_freer (cursor->data);
0
536 cursor->data = -
537 ((void *)0)-
538 ;-
539-
540 next = cursor->next;-
541-
542-
543 cursor->next = table->free_entry_list;-
544 table->free_entry_list = cursor;-
545 }
never executed: end of block
0
546-
547-
548 if (table->data_freer
table->data_freerDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
549 table->data_freer (bucket->data);
never executed: table->data_freer (bucket->data);
0
550 bucket->data = -
551 ((void *)0)-
552 ;-
553 bucket->next = -
554 ((void *)0)-
555 ;-
556 }
never executed: end of block
0
557 }
never executed: end of block
0
558-
559 table->n_buckets_used = 0;-
560 table->n_entries = 0;-
561}
never executed: end of block
0
562-
563-
564-
565-
566-
567-
568void-
569hash_free (Hash_table *table)-
570{-
571 struct hash_entry *bucket;-
572 struct hash_entry *cursor;-
573 struct hash_entry *next;-
574-
575-
576 if (table->data_freer
table->data_freerDescription
TRUEevaluated 5207 times by 12 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • df
  • du
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
FALSEevaluated 28 times by 2 tests
Evaluated by:
  • du
  • tail
&& table->n_entries
table->n_entriesDescription
TRUEevaluated 409 times by 9 tests
Evaluated by:
  • chmod
  • df
  • du
  • ln
  • mv
  • readlink
  • realpath
  • rm
  • shuf
FALSEevaluated 4798 times by 6 tests
Evaluated by:
  • chgrp
  • chown
  • du
  • ls
  • mv
  • rm
)
28-5207
577 {-
578 for (bucket = table->bucket; bucket < table->bucket_limit
bucket < table->bucket_limitDescription
TRUEevaluated 6463 times by 9 tests
Evaluated by:
  • chmod
  • df
  • du
  • ln
  • mv
  • readlink
  • realpath
  • rm
  • shuf
FALSEevaluated 409 times by 9 tests
Evaluated by:
  • chmod
  • df
  • du
  • ln
  • mv
  • readlink
  • realpath
  • rm
  • shuf
; bucket++)
409-6463
579 {-
580 if (bucket->data
bucket->dataDescription
TRUEevaluated 958 times by 9 tests
Evaluated by:
  • chmod
  • df
  • du
  • ln
  • mv
  • readlink
  • realpath
  • rm
  • shuf
FALSEevaluated 5505 times by 9 tests
Evaluated by:
  • chmod
  • df
  • du
  • ln
  • mv
  • readlink
  • realpath
  • rm
  • shuf
)
958-5505
581 {-
582 for (cursor = bucket; cursor
cursorDescription
TRUEevaluated 989 times by 9 tests
Evaluated by:
  • chmod
  • df
  • du
  • ln
  • mv
  • readlink
  • realpath
  • rm
  • shuf
FALSEevaluated 958 times by 9 tests
Evaluated by:
  • chmod
  • df
  • du
  • ln
  • mv
  • readlink
  • realpath
  • rm
  • shuf
; cursor = cursor->next)
958-989
583 table->data_freer (cursor->data);
executed 989 times by 9 tests: table->data_freer (cursor->data);
Executed by:
  • chmod
  • df
  • du
  • ln
  • mv
  • readlink
  • realpath
  • rm
  • shuf
989
584 }
executed 958 times by 9 tests: end of block
Executed by:
  • chmod
  • df
  • du
  • ln
  • mv
  • readlink
  • realpath
  • rm
  • shuf
958
585 }
executed 6463 times by 9 tests: end of block
Executed by:
  • chmod
  • df
  • du
  • ln
  • mv
  • readlink
  • realpath
  • rm
  • shuf
6463
586 }
executed 409 times by 9 tests: end of block
Executed by:
  • chmod
  • df
  • du
  • ln
  • mv
  • readlink
  • realpath
  • rm
  • shuf
409
587 for (bucket = table->bucket; bucket < table->bucket_limit
bucket < table->bucket_limitDescription
TRUEevaluated 134913 times by 13 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • df
  • du
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • tail
FALSEevaluated 5235 times by 13 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • df
  • du
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • tail
; bucket++)
5235-134913
588 {-
589 for (cursor = bucket->next; cursor
cursorDescription
TRUEevaluated 347 times by 4 tests
Evaluated by:
  • df
  • du
  • readlink
  • shuf
FALSEevaluated 134913 times by 13 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • df
  • du
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • tail
; cursor = next)
347-134913
590 {-
591 next = cursor->next;-
592 free (cursor);-
593 }
executed 347 times by 4 tests: end of block
Executed by:
  • df
  • du
  • readlink
  • shuf
347
594 }
executed 134913 times by 13 tests: end of block
Executed by:
  • chgrp
  • chmod
  • chown
  • df
  • du
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • tail
134913
595-
596-
597 for (cursor = table->free_entry_list; cursor
cursorDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • du
FALSEevaluated 5235 times by 13 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • df
  • du
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • tail
; cursor = next)
14-5235
598 {-
599 next = cursor->next;-
600 free (cursor);-
601 }
executed 14 times by 1 test: end of block
Executed by:
  • du
14
602-
603-
604-
605-
606 free (table->bucket);-
607 free (table);-
608}
executed 5235 times by 13 tests: end of block
Executed by:
  • chgrp
  • chmod
  • chown
  • df
  • du
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • tail
5235
609-
610-
611-
612-
613-
614-
615static struct hash_entry *-
616allocate_entry (Hash_table *table)-
617{-
618 struct hash_entry *new;-
619-
620 if (table->free_entry_list
table->free_entry_listDescription
TRUEevaluated 8454 times by 4 tests
Evaluated by:
  • du
  • mv
  • readlink
  • sort
FALSEevaluated 5610 times by 7 tests
Evaluated by:
  • cp
  • df
  • du
  • mv
  • readlink
  • shuf
  • sort
)
5610-8454
621 {-
622 new = table->free_entry_list;-
623 table->free_entry_list = new->next;-
624 }
executed 8454 times by 4 tests: end of block
Executed by:
  • du
  • mv
  • readlink
  • sort
8454
625 else-
626 {-
627-
628-
629-
630 new = malloc (sizeof *new);-
631-
632 }
executed 5610 times by 7 tests: end of block
Executed by:
  • cp
  • df
  • du
  • mv
  • readlink
  • shuf
  • sort
5610
633-
634 return
executed 14064 times by 7 tests: return new;
Executed by:
  • cp
  • df
  • du
  • mv
  • readlink
  • shuf
  • sort
new;
executed 14064 times by 7 tests: return new;
Executed by:
  • cp
  • df
  • du
  • mv
  • readlink
  • shuf
  • sort
14064
635}-
636-
637-
638-
639-
640static void-
641free_entry (Hash_table *table, struct hash_entry *entry)-
642{-
643 entry->data = -
644 ((void *)0)-
645 ;-
646 entry->next = table->free_entry_list;-
647 table->free_entry_list = entry;-
648}
executed 8805 times by 4 tests: end of block
Executed by:
  • du
  • mv
  • readlink
  • sort
8805
649-
650-
651-
652-
653-
654-
655-
656static void *-
657hash_find_entry (Hash_table *table, const void *entry,-
658 struct hash_entry **bucket_head, -
659 _Bool -
660 delete)-
661{-
662 struct hash_entry *bucket = safe_hasher (table, entry);-
663 struct hash_entry *cursor;-
664-
665 *bucket_head = bucket;-
666-
667-
668 if (bucket->data ==
bucket->data == ((void *)0)Description
TRUEevaluated 13077 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
FALSEevaluated 13675 times by 11 tests
Evaluated by:
  • chgrp
  • chown
  • cp
  • df
  • du
  • ls
  • mv
  • readlink
  • shuf
  • sort
  • tail
13077-13675
669 ((void *)0)
bucket->data == ((void *)0)Description
TRUEevaluated 13077 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
FALSEevaluated 13675 times by 11 tests
Evaluated by:
  • chgrp
  • chown
  • cp
  • df
  • du
  • ls
  • mv
  • readlink
  • shuf
  • sort
  • tail
13077-13675
670 )-
671 return
executed 13077 times by 16 tests: return ((void *)0) ;
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
executed 13077 times by 16 tests: return ((void *)0) ;
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
13077
672 ((void *)0)
executed 13077 times by 16 tests: return ((void *)0) ;
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
13077
673 ;
executed 13077 times by 16 tests: return ((void *)0) ;
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
13077
674-
675-
676 if (entry == bucket->data
entry == bucket->dataDescription
TRUEevaluated 274 times by 2 tests
Evaluated by:
  • du
  • tail
FALSEevaluated 13401 times by 11 tests
Evaluated by:
  • chgrp
  • chown
  • cp
  • df
  • du
  • ls
  • mv
  • readlink
  • shuf
  • sort
  • tail
|| table->comparator (entry, bucket->data)
table->compara... bucket->data)Description
TRUEevaluated 5109 times by 9 tests
Evaluated by:
  • chgrp
  • chown
  • cp
  • df
  • du
  • ls
  • mv
  • sort
  • tail
FALSEevaluated 8292 times by 7 tests
Evaluated by:
  • cp
  • df
  • du
  • mv
  • readlink
  • shuf
  • sort
)
274-13401
677 {-
678 void *data = bucket->data;-
679-
680 if (delete
deleteDescription
TRUEevaluated 5305 times by 7 tests
Evaluated by:
  • chgrp
  • chown
  • du
  • ls
  • mv
  • sort
  • tail
FALSEevaluated 78 times by 4 tests
Evaluated by:
  • cp
  • df
  • du
  • mv
)
78-5305
681 {-
682 if (bucket->next
bucket->nextDescription
TRUEevaluated 141 times by 2 tests
Evaluated by:
  • du
  • sort
FALSEevaluated 5164 times by 7 tests
Evaluated by:
  • chgrp
  • chown
  • du
  • ls
  • mv
  • sort
  • tail
)
141-5164
683 {-
684 struct hash_entry *next = bucket->next;-
685-
686-
687-
688 *bucket = *next;-
689 free_entry (table, next);-
690 }
executed 141 times by 2 tests: end of block
Executed by:
  • du
  • sort
141
691 else-
692 {-
693 bucket->data = -
694 ((void *)0)-
695 ;-
696 }
executed 5164 times by 7 tests: end of block
Executed by:
  • chgrp
  • chown
  • du
  • ls
  • mv
  • sort
  • tail
5164
697 }-
698-
699 return
executed 5383 times by 9 tests: return data;
Executed by:
  • chgrp
  • chown
  • cp
  • df
  • du
  • ls
  • mv
  • sort
  • tail
data;
executed 5383 times by 9 tests: return data;
Executed by:
  • chgrp
  • chown
  • cp
  • df
  • du
  • ls
  • mv
  • sort
  • tail
5383
700 }-
701-
702-
703 for (cursor = bucket; cursor->next
cursor->nextDescription
TRUEevaluated 5237 times by 5 tests
Evaluated by:
  • cp
  • du
  • mv
  • readlink
  • sort
FALSEevaluated 8221 times by 7 tests
Evaluated by:
  • cp
  • df
  • du
  • mv
  • readlink
  • shuf
  • sort
; cursor = cursor->next)
5237-8221
704 {-
705 if (entry == cursor->next->data
entry == cursor->next->dataDescription
TRUEnever evaluated
FALSEevaluated 5237 times by 5 tests
Evaluated by:
  • cp
  • du
  • mv
  • readlink
  • sort
0-5237
706 || table->comparator (entry, cursor->next->data)
table->compara...r->next->data)Description
TRUEevaluated 71 times by 2 tests
Evaluated by:
  • du
  • sort
FALSEevaluated 5166 times by 4 tests
Evaluated by:
  • cp
  • mv
  • readlink
  • sort
)
71-5166
707 {-
708 void *data = cursor->next->data;-
709-
710 if (delete
deleteDescription
TRUEevaluated 71 times by 2 tests
Evaluated by:
  • du
  • sort
FALSEnever evaluated
)
0-71
711 {-
712 struct hash_entry *next = cursor->next;-
713-
714-
715-
716 cursor->next = next->next;-
717 free_entry (table, next);-
718 }
executed 71 times by 2 tests: end of block
Executed by:
  • du
  • sort
71
719-
720 return
executed 71 times by 2 tests: return data;
Executed by:
  • du
  • sort
data;
executed 71 times by 2 tests: return data;
Executed by:
  • du
  • sort
71
721 }-
722 }
executed 5166 times by 4 tests: end of block
Executed by:
  • cp
  • mv
  • readlink
  • sort
5166
723-
724-
725 return
executed 8221 times by 7 tests: return ((void *)0) ;
Executed by:
  • cp
  • df
  • du
  • mv
  • readlink
  • shuf
  • sort
executed 8221 times by 7 tests: return ((void *)0) ;
Executed by:
  • cp
  • df
  • du
  • mv
  • readlink
  • shuf
  • sort
8221
726 ((void *)0)
executed 8221 times by 7 tests: return ((void *)0) ;
Executed by:
  • cp
  • df
  • du
  • mv
  • readlink
  • shuf
  • sort
8221
727 ;
executed 8221 times by 7 tests: return ((void *)0) ;
Executed by:
  • cp
  • df
  • du
  • mv
  • readlink
  • shuf
  • sort
8221
728}-
729-
730-
731-
732-
733-
734-
735-
736static -
737 _Bool-
738-
739transfer_entries (Hash_table *dst, Hash_table *src, -
740 _Bool -
741 safe)-
742{-
743 struct hash_entry *bucket;-
744 struct hash_entry *cursor;-
745 struct hash_entry *next;-
746 for (bucket = src->bucket; bucket < src->bucket_limit
bucket < src->bucket_limitDescription
TRUEevaluated 24874 times by 3 tests
Evaluated by:
  • du
  • mv
  • readlink
FALSEevaluated 26 times by 3 tests
Evaluated by:
  • du
  • mv
  • readlink
; bucket++)
26-24874
747 if (bucket->data
bucket->dataDescription
TRUEevaluated 19910 times by 3 tests
Evaluated by:
  • du
  • mv
  • readlink
FALSEevaluated 4964 times by 3 tests
Evaluated by:
  • du
  • mv
  • readlink
)
4964-19910
748 {-
749 void *data;-
750 struct hash_entry *new_bucket;-
751-
752-
753-
754-
755-
756-
757-
758 for (cursor = bucket->next; cursor
cursorDescription
TRUEevaluated 12706 times by 3 tests
Evaluated by:
  • du
  • mv
  • readlink
FALSEevaluated 19910 times by 3 tests
Evaluated by:
  • du
  • mv
  • readlink
; cursor = next)
12706-19910
759 {-
760 data = cursor->data;-
761 new_bucket = safe_hasher (dst, data);-
762-
763 next = cursor->next;-
764-
765 if (new_bucket->data
new_bucket->dataDescription
TRUEevaluated 4113 times by 3 tests
Evaluated by:
  • du
  • mv
  • readlink
FALSEevaluated 8593 times by 3 tests
Evaluated by:
  • du
  • mv
  • readlink
)
4113-8593
766 {-
767-
768-
769 cursor->next = new_bucket->next;-
770 new_bucket->next = cursor;-
771 }
executed 4113 times by 3 tests: end of block
Executed by:
  • du
  • mv
  • readlink
4113
772 else-
773 {-
774-
775-
776 new_bucket->data = data;-
777 dst->n_buckets_used++;-
778 free_entry (dst, cursor);-
779 }
executed 8593 times by 3 tests: end of block
Executed by:
  • du
  • mv
  • readlink
8593
780 }-
781-
782-
783-
784 data = bucket->data;-
785 bucket->next = -
786 ((void *)0)-
787 ;-
788 if (safe
safeDescription
TRUEnever evaluated
FALSEevaluated 19910 times by 3 tests
Evaluated by:
  • du
  • mv
  • readlink
)
0-19910
789 continue;
never executed: continue;
0
790 new_bucket = safe_hasher (dst, data);-
791-
792 if (new_bucket->data
new_bucket->dataDescription
TRUEevaluated 5859 times by 3 tests
Evaluated by:
  • du
  • mv
  • readlink
FALSEevaluated 14051 times by 3 tests
Evaluated by:
  • du
  • mv
  • readlink
)
5859-14051
793 {-
794-
795-
796 struct hash_entry *new_entry = allocate_entry (dst);-
797-
798 if (new_entry ==
new_entry == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 5859 times by 3 tests
Evaluated by:
  • du
  • mv
  • readlink
0-5859
799 ((void *)0)
new_entry == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 5859 times by 3 tests
Evaluated by:
  • du
  • mv
  • readlink
0-5859
800 )-
801 return
never executed: return 0 ;
never executed: return 0 ;
0
802 0
never executed: return 0 ;
0
803 ;
never executed: return 0 ;
0
804-
805 new_entry->data = data;-
806 new_entry->next = new_bucket->next;-
807 new_bucket->next = new_entry;-
808 }
executed 5859 times by 3 tests: end of block
Executed by:
  • du
  • mv
  • readlink
5859
809 else-
810 {-
811-
812 new_bucket->data = data;-
813 dst->n_buckets_used++;-
814 }
executed 14051 times by 3 tests: end of block
Executed by:
  • du
  • mv
  • readlink
14051
815 bucket->data = -
816 ((void *)0)-
817 ;-
818 src->n_buckets_used--;-
819 }
executed 19910 times by 3 tests: end of block
Executed by:
  • du
  • mv
  • readlink
19910
820 return
executed 26 times by 3 tests: return 1 ;
Executed by:
  • du
  • mv
  • readlink
executed 26 times by 3 tests: return 1 ;
Executed by:
  • du
  • mv
  • readlink
26
821 1
executed 26 times by 3 tests: return 1 ;
Executed by:
  • du
  • mv
  • readlink
26
822 ;
executed 26 times by 3 tests: return 1 ;
Executed by:
  • du
  • mv
  • readlink
26
823}-
824-
825_Bool-
826-
827hash_rehash (Hash_table *table, size_t candidate)-
828{-
829 Hash_table storage;-
830 Hash_table *new_table;-
831 size_t new_size = compute_bucket_size (candidate, table->tuning);-
832-
833 if (!new_size
!new_sizeDescription
TRUEnever evaluated
FALSEevaluated 26 times by 3 tests
Evaluated by:
  • du
  • mv
  • readlink
)
0-26
834 return
never executed: return 0 ;
never executed: return 0 ;
0
835 0
never executed: return 0 ;
0
836 ;
never executed: return 0 ;
0
837 if (new_size == table->n_buckets
new_size == table->n_bucketsDescription
TRUEnever evaluated
FALSEevaluated 26 times by 3 tests
Evaluated by:
  • du
  • mv
  • readlink
)
0-26
838 return
never executed: return 1 ;
never executed: return 1 ;
0
839 1
never executed: return 1 ;
0
840 ;
never executed: return 1 ;
0
841 new_table = &storage;-
842 new_table->bucket = calloc (new_size, sizeof *new_table->bucket);-
843 if (new_table->bucket ==
new_table->buc...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 26 times by 3 tests
Evaluated by:
  • du
  • mv
  • readlink
0-26
844 ((void *)0)
new_table->buc...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 26 times by 3 tests
Evaluated by:
  • du
  • mv
  • readlink
0-26
845 )-
846 return
never executed: return 0 ;
never executed: return 0 ;
0
847 0
never executed: return 0 ;
0
848 ;
never executed: return 0 ;
0
849 new_table->n_buckets = new_size;-
850 new_table->bucket_limit = new_table->bucket + new_size;-
851 new_table->n_buckets_used = 0;-
852 new_table->n_entries = 0;-
853 new_table->tuning = table->tuning;-
854 new_table->hasher = table->hasher;-
855 new_table->comparator = table->comparator;-
856 new_table->data_freer = table->data_freer;-
857 new_table->free_entry_list = table->free_entry_list;-
858-
859 if (transfer_entries (new_table, table,
transfer_entri...le, table, 0 )Description
TRUEevaluated 26 times by 3 tests
Evaluated by:
  • du
  • mv
  • readlink
FALSEnever evaluated
0-26
860 0
transfer_entri...le, table, 0 )Description
TRUEevaluated 26 times by 3 tests
Evaluated by:
  • du
  • mv
  • readlink
FALSEnever evaluated
0-26
861 )
transfer_entri...le, table, 0 )Description
TRUEevaluated 26 times by 3 tests
Evaluated by:
  • du
  • mv
  • readlink
FALSEnever evaluated
)
0-26
862 {-
863-
864 free (table->bucket);-
865 table->bucket = new_table->bucket;-
866 table->bucket_limit = new_table->bucket_limit;-
867 table->n_buckets = new_table->n_buckets;-
868 table->n_buckets_used = new_table->n_buckets_used;-
869 table->free_entry_list = new_table->free_entry_list;-
870-
871 return
executed 26 times by 3 tests: return 1 ;
Executed by:
  • du
  • mv
  • readlink
executed 26 times by 3 tests: return 1 ;
Executed by:
  • du
  • mv
  • readlink
26
872 1
executed 26 times by 3 tests: return 1 ;
Executed by:
  • du
  • mv
  • readlink
26
873 ;
executed 26 times by 3 tests: return 1 ;
Executed by:
  • du
  • mv
  • readlink
26
874 }-
875 table->free_entry_list = new_table->free_entry_list;-
876 if (! (transfer_entries (table, new_table,
transfer_entri...new_table, 1 )Description
TRUEnever evaluated
FALSEnever evaluated
0
877 1
transfer_entri...new_table, 1 )Description
TRUEnever evaluated
FALSEnever evaluated
0
878 )
transfer_entri...new_table, 1 )Description
TRUEnever evaluated
FALSEnever evaluated
0
879 && transfer_entries (table, new_table,
transfer_entri...new_table, 0 )Description
TRUEnever evaluated
FALSEnever evaluated
0
880 0
transfer_entri...new_table, 0 )Description
TRUEnever evaluated
FALSEnever evaluated
0
881 )
transfer_entri...new_table, 0 )Description
TRUEnever evaluated
FALSEnever evaluated
))
0
882 abort ();
never executed: abort ();
0
883-
884 free (new_table->bucket);-
885 return
never executed: return 0 ;
never executed: return 0 ;
0
886 0
never executed: return 0 ;
0
887 ;
never executed: return 0 ;
0
888}-
889int-
890hash_insert_if_absent (Hash_table *table, void const *entry,-
891 void const **matched_ent)-
892{-
893 void *data;-
894 struct hash_entry *bucket;-
895-
896-
897-
898-
899 if (! entry
! entryDescription
TRUEnever evaluated
FALSEevaluated 21080 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
)
0-21080
900 abort ();
never executed: abort ();
0
901-
902-
903 if ((
(data = hash_f...!= ((void *)0)Description
TRUEevaluated 78 times by 4 tests
Evaluated by:
  • cp
  • df
  • du
  • mv
FALSEevaluated 21002 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
data = hash_find_entry (table, entry, &bucket,
(data = hash_f...!= ((void *)0)Description
TRUEevaluated 78 times by 4 tests
Evaluated by:
  • cp
  • df
  • du
  • mv
FALSEevaluated 21002 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
78-21002
904 0
(data = hash_f...!= ((void *)0)Description
TRUEevaluated 78 times by 4 tests
Evaluated by:
  • cp
  • df
  • du
  • mv
FALSEevaluated 21002 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
78-21002
905 )) !=
(data = hash_f...!= ((void *)0)Description
TRUEevaluated 78 times by 4 tests
Evaluated by:
  • cp
  • df
  • du
  • mv
FALSEevaluated 21002 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
78-21002
906 ((void *)0)
(data = hash_f...!= ((void *)0)Description
TRUEevaluated 78 times by 4 tests
Evaluated by:
  • cp
  • df
  • du
  • mv
FALSEevaluated 21002 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
78-21002
907 )-
908 {-
909 if (matched_ent
matched_entDescription
TRUEevaluated 59 times by 4 tests
Evaluated by:
  • cp
  • df
  • du
  • mv
FALSEevaluated 19 times by 1 test
Evaluated by:
  • du
)
19-59
910 *
executed 59 times by 4 tests: *matched_ent = data;
Executed by:
  • cp
  • df
  • du
  • mv
matched_ent = data;
executed 59 times by 4 tests: *matched_ent = data;
Executed by:
  • cp
  • df
  • du
  • mv
59
911 return
executed 78 times by 4 tests: return 0;
Executed by:
  • cp
  • df
  • du
  • mv
0;
executed 78 times by 4 tests: return 0;
Executed by:
  • cp
  • df
  • du
  • mv
78
912 }-
913-
914-
915-
916-
917-
918-
919 if (table->n_buckets_used
table->n_bucke...ble->n_bucketsDescription
TRUEevaluated 26 times by 3 tests
Evaluated by:
  • du
  • mv
  • readlink
FALSEevaluated 20976 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
26-20976
920 > table->tuning->growth_threshold * table->n_buckets
table->n_bucke...ble->n_bucketsDescription
TRUEevaluated 26 times by 3 tests
Evaluated by:
  • du
  • mv
  • readlink
FALSEevaluated 20976 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
)
26-20976
921 {-
922-
923-
924 check_tuning (table);-
925 if (table->n_buckets_used
table->n_bucke...ble->n_bucketsDescription
TRUEevaluated 26 times by 3 tests
Evaluated by:
  • du
  • mv
  • readlink
FALSEnever evaluated
0-26
926 > table->tuning->growth_threshold * table->n_buckets
table->n_bucke...ble->n_bucketsDescription
TRUEevaluated 26 times by 3 tests
Evaluated by:
  • du
  • mv
  • readlink
FALSEnever evaluated
)
0-26
927 {-
928 const Hash_tuning *tuning = table->tuning;-
929 float candidate =-
930 (tuning->is_n_buckets
tuning->is_n_bucketsDescription
TRUEnever evaluated
FALSEevaluated 26 times by 3 tests
Evaluated by:
  • du
  • mv
  • readlink
0-26
931 ? (table->n_buckets * tuning->growth_factor)-
932 : (table->n_buckets * tuning->growth_factor-
933 * tuning->growth_threshold));-
934-
935 if (-
936 (
(1844674407370...) <= candidateDescription
TRUEnever evaluated
FALSEevaluated 26 times by 3 tests
Evaluated by:
  • du
  • mv
  • readlink
18446744073709551615UL)
(1844674407370...) <= candidateDescription
TRUEnever evaluated
FALSEevaluated 26 times by 3 tests
Evaluated by:
  • du
  • mv
  • readlink
0-26
937 <= candidate
(1844674407370...) <= candidateDescription
TRUEnever evaluated
FALSEevaluated 26 times by 3 tests
Evaluated by:
  • du
  • mv
  • readlink
)
0-26
938 return
never executed: return -1;
-1;
never executed: return -1;
0
939-
940-
941 if (!hash_rehash (table, candidate)
!hash_rehash (...le, candidate)Description
TRUEnever evaluated
FALSEevaluated 26 times by 3 tests
Evaluated by:
  • du
  • mv
  • readlink
)
0-26
942 return
never executed: return -1;
-1;
never executed: return -1;
0
943-
944-
945 if (hash_find_entry (table, entry, &bucket,
hash_find_entr...!= ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 26 times by 3 tests
Evaluated by:
  • du
  • mv
  • readlink
0-26
946 0
hash_find_entr...!= ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 26 times by 3 tests
Evaluated by:
  • du
  • mv
  • readlink
0-26
947 ) !=
hash_find_entr...!= ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 26 times by 3 tests
Evaluated by:
  • du
  • mv
  • readlink
0-26
948 ((void *)0)
hash_find_entr...!= ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 26 times by 3 tests
Evaluated by:
  • du
  • mv
  • readlink
0-26
949 )-
950 abort ();
never executed: abort ();
0
951 }
executed 26 times by 3 tests: end of block
Executed by:
  • du
  • mv
  • readlink
26
952 }
executed 26 times by 3 tests: end of block
Executed by:
  • du
  • mv
  • readlink
26
953-
954-
955-
956 if (bucket->data
bucket->dataDescription
TRUEevaluated 8205 times by 7 tests
Evaluated by:
  • cp
  • df
  • du
  • mv
  • readlink
  • shuf
  • sort
FALSEevaluated 12797 times by 16 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
)
8205-12797
957 {-
958 struct hash_entry *new_entry = allocate_entry (table);-
959-
960 if (new_entry ==
new_entry == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8205 times by 7 tests
Evaluated by:
  • cp
  • df
  • du
  • mv
  • readlink
  • shuf
  • sort
0-8205
961 ((void *)0)
new_entry == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8205 times by 7 tests
Evaluated by:
  • cp
  • df
  • du
  • mv
  • readlink
  • shuf
  • sort
0-8205
962 )-
963 return
never executed: return -1;
-1;
never executed: return -1;
0
964-
965-
966-
967 new_entry->data = (void *) entry;-
968 new_entry->next = bucket->next;-
969 bucket->next = new_entry;-
970 table->n_entries++;-
971 return
executed 8205 times by 7 tests: return 1;
Executed by:
  • cp
  • df
  • du
  • mv
  • readlink
  • shuf
  • sort
1;
executed 8205 times by 7 tests: return 1;
Executed by:
  • cp
  • df
  • du
  • mv
  • readlink
  • shuf
  • sort
8205
972 }-
973-
974-
975-
976 bucket->data = (void *) entry;-
977 table->n_entries++;-
978 table->n_buckets_used++;-
979-
980 return
executed 12797 times by 16 tests: return 1;
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
1;
executed 12797 times by 16 tests: return 1;
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
12797
981}-
982-
983-
984-
985-
986-
987-
988-
989void *-
990hash_insert (Hash_table *table, void const *entry)-
991{-
992 void const *matched_ent;-
993 int err = hash_insert_if_absent (table, entry, &matched_ent);-
994 return
executed 18473 times by 16 tests: return (err == -1 ? ((void *)0) : (void *) (err == 0 ? matched_ent : entry));
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
(err == -1
executed 18473 times by 16 tests: return (err == -1 ? ((void *)0) : (void *) (err == 0 ? matched_ent : entry));
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
18473
995 ?
executed 18473 times by 16 tests: return (err == -1 ? ((void *)0) : (void *) (err == 0 ? matched_ent : entry));
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
18473
996 ((void *)0)
executed 18473 times by 16 tests: return (err == -1 ? ((void *)0) : (void *) (err == 0 ? matched_ent : entry));
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
18473
997
executed 18473 times by 16 tests: return (err == -1 ? ((void *)0) : (void *) (err == 0 ? matched_ent : entry));
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
18473
998 : (void *) (err == 0 ? matched_ent : entry));
executed 18473 times by 16 tests: return (err == -1 ? ((void *)0) : (void *) (err == 0 ? matched_ent : entry));
Executed by:
  • chgrp
  • chmod
  • chown
  • cp
  • df
  • du
  • ginstall
  • ln
  • ls
  • mv
  • readlink
  • realpath
  • rm
  • shuf
  • sort
  • tail
18473
999}-
1000-
1001-
1002-
1003-
1004-
1005void *-
1006hash_delete (Hash_table *table, const void *entry)-
1007{-
1008 void *data;-
1009 struct hash_entry *bucket;-
1010-
1011 data = hash_find_entry (table, entry, &bucket, -
1012 1-
1013 );-
1014 if (!data
!dataDescription
TRUEevaluated 270 times by 5 tests
Evaluated by:
  • cp
  • mv
  • shuf
  • sort
  • tail
FALSEevaluated 5376 times by 7 tests
Evaluated by:
  • chgrp
  • chown
  • du
  • ls
  • mv
  • sort
  • tail
)
270-5376
1015 return
executed 270 times by 5 tests: return ((void *)0) ;
Executed by:
  • cp
  • mv
  • shuf
  • sort
  • tail
executed 270 times by 5 tests: return ((void *)0) ;
Executed by:
  • cp
  • mv
  • shuf
  • sort
  • tail
270
1016 ((void *)0)
executed 270 times by 5 tests: return ((void *)0) ;
Executed by:
  • cp
  • mv
  • shuf
  • sort
  • tail
270
1017 ;
executed 270 times by 5 tests: return ((void *)0) ;
Executed by:
  • cp
  • mv
  • shuf
  • sort
  • tail
270
1018-
1019 table->n_entries--;-
1020 if (!bucket->data
!bucket->dataDescription
TRUEevaluated 5164 times by 7 tests
Evaluated by:
  • chgrp
  • chown
  • du
  • ls
  • mv
  • sort
  • tail
FALSEevaluated 212 times by 2 tests
Evaluated by:
  • du
  • sort
)
212-5164
1021 {-
1022 table->n_buckets_used--;-
1023-
1024-
1025-
1026-
1027 if (table->n_buckets_used
table->n_bucke...ble->n_bucketsDescription
TRUEnever evaluated
FALSEevaluated 5164 times by 7 tests
Evaluated by:
  • chgrp
  • chown
  • du
  • ls
  • mv
  • sort
  • tail
0-5164
1028 < table->tuning->shrink_threshold * table->n_buckets
table->n_bucke...ble->n_bucketsDescription
TRUEnever evaluated
FALSEevaluated 5164 times by 7 tests
Evaluated by:
  • chgrp
  • chown
  • du
  • ls
  • mv
  • sort
  • tail
)
0-5164
1029 {-
1030-
1031-
1032 check_tuning (table);-
1033 if (table->n_buckets_used
table->n_bucke...ble->n_bucketsDescription
TRUEnever evaluated
FALSEnever evaluated
0
1034 < table->tuning->shrink_threshold * table->n_buckets
table->n_bucke...ble->n_bucketsDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1035 {-
1036 const Hash_tuning *tuning = table->tuning;-
1037 size_t candidate =-
1038 (tuning->is_n_buckets
tuning->is_n_bucketsDescription
TRUEnever evaluated
FALSEnever evaluated
0
1039 ? table->n_buckets * tuning->shrink_factor-
1040 : (table->n_buckets * tuning->shrink_factor-
1041 * tuning->growth_threshold));-
1042-
1043 if (!hash_rehash (table, candidate)
!hash_rehash (...le, candidate)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1044 {-
1045-
1046-
1047-
1048-
1049-
1050-
1051 struct hash_entry *cursor = table->free_entry_list;-
1052 struct hash_entry *next;-
1053 while (cursor
cursorDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1054 {-
1055 next = cursor->next;-
1056 free (cursor);-
1057 cursor = next;-
1058 }
never executed: end of block
0
1059 table->free_entry_list = -
1060 ((void *)0)-
1061 ;-
1062-
1063 }
never executed: end of block
0
1064 }
never executed: end of block
0
1065 }
never executed: end of block
0
1066 }
executed 5164 times by 7 tests: end of block
Executed by:
  • chgrp
  • chown
  • du
  • ls
  • mv
  • sort
  • tail
5164
1067-
1068 return
executed 5376 times by 7 tests: return data;
Executed by:
  • chgrp
  • chown
  • du
  • ls
  • mv
  • sort
  • tail
data;
executed 5376 times by 7 tests: return data;
Executed by:
  • chgrp
  • chown
  • du
  • ls
  • mv
  • sort
  • tail
5376
1069}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.1.2