| 93 | /* debug_htable_grow - extend existing table */ |
| 94 | |
| 95 | static int debug_htable_grow(DEBUG_HTABLE *table) |
| 96 | { |
| 97 | int ret; |
| 98 | DEBUG_HTABLE_INFO *ht; |
| 99 | DEBUG_HTABLE_INFO *next; |
| 100 | unsigned old_size = table->size; |
| 101 | DEBUG_HTABLE_INFO **h0 = table->data; |
| 102 | DEBUG_HTABLE_INFO **old_entries = h0; |
| 103 | unsigned n; |
| 104 | |
| 105 | ret = debug_htable_size(table, 2 * old_size); |
| 106 | if (ret < 0) |
| 107 | return(-1); |
| 108 | |
| 109 | while (old_size-- > 0) { |
| 110 | for (ht = *h0++; ht; ht = next) { |
| 111 | next = ht->next; |
| 112 | n = table->hash_fn(ht->key, strlen(ht->key)) % table->size; |
| 113 | debug_htable_link(table, ht, n); |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | FREE(old_entries); |
| 118 | |
| 119 | return(0); |
| 120 | } |
| 121 | |
| 122 | /* debug_htable_create - create initial hash table */ |
| 123 |
no test coverage detected
searching dependent graphs…