MCPcopy Create free account
hub / github.com/acl-dev/acl / debug_htable_grow

Function debug_htable_grow

lib_acl/src/stdlib/debug/debug_htable.c:95–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93/* debug_htable_grow - extend existing table */
94
95static 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

Callers 1

debug_htable_enterFunction · 0.85

Calls 1

debug_htable_sizeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…