Lines Matching refs:table
57 hash_table *table; in ht_create() local
59 table = XCNEW (hash_table); in ht_create()
62 _obstack_begin (&table->stack, 0, 0, in ht_create()
66 obstack_alignment_mask (&table->stack) = 0; in ht_create()
68 table->entries = XCNEWVEC (hashnode, nslots); in ht_create()
69 table->entries_owned = true; in ht_create()
70 table->nslots = nslots; in ht_create()
71 return table; in ht_create()
77 ht_destroy (hash_table *table) in ht_destroy() argument
79 obstack_free (&table->stack, NULL); in ht_destroy()
80 if (table->entries_owned) in ht_destroy()
81 free (table->entries); in ht_destroy()
82 free (table); in ht_destroy()
94 ht_lookup (hash_table *table, const unsigned char *str, size_t len, in ht_lookup() argument
97 return ht_lookup_with_hash (table, str, len, calc_hash (str, len), in ht_lookup()
102 ht_lookup_with_hash (hash_table *table, const unsigned char *str, in ht_lookup_with_hash() argument
111 sizemask = table->nslots - 1; in ht_lookup_with_hash()
113 table->searches++; in ht_lookup_with_hash()
115 node = table->entries[index]; in ht_lookup_with_hash()
126 obstack_free (&table->stack, (void *) str); in ht_lookup_with_hash()
136 table->collisions++; in ht_lookup_with_hash()
138 node = table->entries[index]; in ht_lookup_with_hash()
149 obstack_free (&table->stack, (void *) str); in ht_lookup_with_hash()
158 node = (*table->alloc_node) (table); in ht_lookup_with_hash()
159 table->entries[index] = node; in ht_lookup_with_hash()
164 HT_STR (node) = (const unsigned char *) obstack_copy0 (&table->stack, in ht_lookup_with_hash()
169 if (++table->nelements * 4 >= table->nslots * 3) in ht_lookup_with_hash()
171 ht_expand (table); in ht_lookup_with_hash()
179 ht_expand (hash_table *table) in ht_expand() argument
184 size = table->nslots * 2; in ht_expand()
188 p = table->entries; in ht_expand()
189 limit = p + table->nslots; in ht_expand()
211 if (table->entries_owned) in ht_expand()
212 free (table->entries); in ht_expand()
213 table->entries_owned = true; in ht_expand()
214 table->entries = nentries; in ht_expand()
215 table->nslots = size; in ht_expand()
221 ht_forall (hash_table *table, ht_cb cb, const void *v) in ht_forall() argument
225 p = table->entries; in ht_forall()
226 limit = p + table->nslots; in ht_forall()
230 if ((*cb) (table->pfile, *p, v) == 0) in ht_forall()
253 ht_dump_statistics (hash_table *table) in ht_dump_statistics() argument
268 p = table->entries; in ht_dump_statistics()
269 limit = p + table->nslots; in ht_dump_statistics()
283 nelts = table->nelements; in ht_dump_statistics()
284 overhead = obstack_memory_used (&table->stack) - total_bytes; in ht_dump_statistics()
285 headers = table->nslots * sizeof (hashnode); in ht_dump_statistics()
292 (unsigned long) table->nslots); in ht_dump_statistics()
304 (double) table->collisions / (double) table->searches); in ht_dump_statistics()
306 (double) nelts / (double) table->searches); in ht_dump_statistics()