| 291 | } |
| 292 | |
| 293 | int debug_htable_reset(DEBUG_HTABLE *table, void (*free_fn) (char *)) |
| 294 | { |
| 295 | if (table) { |
| 296 | unsigned i = table->size; |
| 297 | DEBUG_HTABLE_INFO *ht; |
| 298 | DEBUG_HTABLE_INFO *next; |
| 299 | DEBUG_HTABLE_INFO **h; |
| 300 | int ret; |
| 301 | |
| 302 | h = table->data; |
| 303 | |
| 304 | while (i-- > 0) { |
| 305 | for (ht = *h++; ht; ht = next) { |
| 306 | next = ht->next; |
| 307 | FREE(ht->key); |
| 308 | if (free_fn && ht->value) |
| 309 | (*free_fn) (ht->value); |
| 310 | FREE(ht); |
| 311 | } |
| 312 | } |
| 313 | FREE(table->data); |
| 314 | table->data = 0; |
| 315 | |
| 316 | ret = debug_htable_size(table, table->init_size < 13 ? 13 : table->init_size); |
| 317 | return (ret); |
| 318 | } |
| 319 | |
| 320 | return (-1); |
| 321 | } |
| 322 | |
| 323 | /* debug_htable_walk - iterate over hash table */ |
| 324 |
nothing calls this directly
no test coverage detected
searching dependent graphs…