• Home
  • History
  • Annotate
  • Raw
  • Download

Lines Matching refs:table

74    VgHashTable *table   = VG_(calloc)("hashtable.Hc.1",  in VG_()  local
76 table->chains = VG_(calloc)("hashtable.Hc.2", 1, sz); in VG_()
77 table->n_chains = n_chains; in VG_()
78 table->n_elements = 0; in VG_()
79 table->iterOK = True; in VG_()
80 table->name = name; in VG_()
82 return table; in VG_()
85 UInt VG_(HT_count_nodes) ( const VgHashTable *table ) in VG_()
87 return table->n_elements; in VG_()
90 static void resize ( VgHashTable *table ) in resize() argument
94 SizeT old_chains = table->n_chains; in resize()
120 table->name, (UWord)old_chains, (UWord)new_chains, in resize()
121 (UWord)table->n_elements ); in resize()
123 table->n_chains = new_chains; in resize()
128 node = table->chains[i]; in resize()
131 UWord chain = CHAIN_NO(node->key, table); in resize()
138 VG_(free)(table->chains); in resize()
139 table->chains = chains; in resize()
144 void VG_(HT_add_node) ( VgHashTable *table, void* vnode ) in VG_()
147 UWord chain = CHAIN_NO(node->key, table); in VG_()
148 node->next = table->chains[chain]; in VG_()
149 table->chains[chain] = node; in VG_()
150 table->n_elements++; in VG_()
151 if ( (1 * (ULong)table->n_elements) > (1 * (ULong)table->n_chains) ) { in VG_()
152 resize(table); in VG_()
156 table->iterOK = False; in VG_()
160 void* VG_(HT_lookup) ( const VgHashTable *table, UWord key ) in VG_()
162 VgHashNode* curr = table->chains[ CHAIN_NO(key, table) ]; in VG_()
175 void* VG_(HT_gen_lookup) ( const VgHashTable *table, const void* node, in VG_()
179 VgHashNode* curr = table->chains[ CHAIN_NO(hnode->key, table) ]; // GEN!!! in VG_()
191 void* VG_(HT_remove) ( VgHashTable *table, UWord key ) in VG_()
193 UWord chain = CHAIN_NO(key, table); in VG_()
194 VgHashNode* curr = table->chains[chain]; in VG_()
195 VgHashNode** prev_next_ptr = &(table->chains[chain]); in VG_()
198 table->iterOK = False; in VG_()
203 table->n_elements--; in VG_()
214 void* VG_(HT_gen_remove) ( VgHashTable *table, const void* node, HT_Cmp_t cmp ) in VG_()
217 UWord chain = CHAIN_NO(hnode->key, table); // GEN!!! in VG_()
218 VgHashNode* curr = table->chains[chain]; in VG_()
219 VgHashNode** prev_next_ptr = &(table->chains[chain]); in VG_()
222 table->iterOK = False; in VG_()
227 table->n_elements--; in VG_()
236 void VG_(HT_print_stats) ( const VgHashTable *table, HT_Cmp_t cmp ) in VG_()
258 for (i = 0; i < table->n_chains; i++) { in VG_()
260 for (cnode = table->chains[i]; cnode != NULL; cnode = cnode->next) { in VG_()
265 for (node = table->chains[i]; node != cnode; node = node->next) { in VG_()
280 for (node = table->chains[i]; node != cnode; node = node->next) { in VG_()
331 VgHashNode** VG_(HT_to_array) (const VgHashTable *table, /*OUT*/ UInt* n_elems) in VG_()
337 *n_elems = table->n_elements; in VG_()
344 for (i = 0; i < table->n_chains; i++) { in VG_()
345 for (node = table->chains[i]; node != NULL; node = node->next) { in VG_()
354 void VG_(HT_ResetIter)(VgHashTable *table) in VG_()
356 vg_assert(table); in VG_()
357 table->iterNode = NULL; in VG_()
358 table->iterChain = 0; in VG_()
359 table->iterOK = True; in VG_()
362 void* VG_(HT_Next)(VgHashTable *table) in VG_()
365 vg_assert(table); in VG_()
369 vg_assert(table->iterOK); in VG_()
371 if (table->iterNode && table->iterNode->next) { in VG_()
372 table->iterNode = table->iterNode->next; in VG_()
373 return table->iterNode; in VG_()
376 for (i = table->iterChain; i < table->n_chains; i++) { in VG_()
377 if (table->chains[i]) { in VG_()
378 table->iterNode = table->chains[i]; in VG_()
379 table->iterChain = i + 1; // Next chain to be traversed in VG_()
380 return table->iterNode; in VG_()
386 void VG_(HT_destruct)(VgHashTable *table, void(*freenode_fn)(void*)) in VG_()
391 for (i = 0; i < table->n_chains; i++) { in VG_()
392 for (node = table->chains[i]; node != NULL; node = node_next) { in VG_()
397 VG_(free)(table->chains); in VG_()
398 VG_(free)(table); in VG_()