Lines Matching refs:table

60   hash_table *table;  in ht_create()  local
62 table = XCNEW (hash_table); in ht_create()
65 _obstack_begin (&table->stack, 0, 0, in ht_create()
69 obstack_alignment_mask (&table->stack) = 0; in ht_create()
71 table->entries = XCNEWVEC (hashnode, nslots); in ht_create()
72 table->entries_owned = true; in ht_create()
73 table->nslots = nslots; in ht_create()
74 return table; in ht_create()
80 ht_destroy (hash_table *table) in ht_destroy() argument
82 obstack_free (&table->stack, NULL); in ht_destroy()
83 if (table->entries_owned) in ht_destroy()
84 free (table->entries); in ht_destroy()
85 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
108 unsigned int deleted_index = table->nslots; in ht_lookup_with_hash()
112 sizemask = table->nslots - 1; in ht_lookup_with_hash()
114 table->searches++; in ht_lookup_with_hash()
116 node = table->entries[index]; in ht_lookup_with_hash()
133 table->collisions++; in ht_lookup_with_hash()
135 node = table->entries[index]; in ht_lookup_with_hash()
141 if (deleted_index != table->nslots) in ht_lookup_with_hash()
155 if (deleted_index != table->nslots) 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 if (table->alloc_subobject) in ht_lookup_with_hash()
166 char *chars = (char *) table->alloc_subobject (len + 1); in ht_lookup_with_hash()
172 HT_STR (node) = (const unsigned char *) obstack_copy0 (&table->stack, in ht_lookup_with_hash()
175 if (++table->nelements * 4 >= table->nslots * 3) in ht_lookup_with_hash()
177 ht_expand (table); in ht_lookup_with_hash()
185 ht_expand (hash_table *table) in ht_expand() argument
190 size = table->nslots * 2; in ht_expand()
194 p = table->entries; in ht_expand()
195 limit = p + table->nslots; in ht_expand()
217 if (table->entries_owned) in ht_expand()
218 free (table->entries); in ht_expand()
219 table->entries_owned = true; in ht_expand()
220 table->entries = nentries; in ht_expand()
221 table->nslots = size; in ht_expand()
227 ht_forall (hash_table *table, ht_cb cb, const void *v) in ht_forall() argument
231 p = table->entries; in ht_forall()
232 limit = p + table->nslots; in ht_forall()
236 if ((*cb) (table->pfile, *p, v) == 0) in ht_forall()
245 ht_purge (hash_table *table, ht_cb cb, const void *v) in ht_purge() argument
249 p = table->entries; in ht_purge()
250 limit = p + table->nslots; in ht_purge()
254 if ((*cb) (table->pfile, *p, v)) in ht_purge()
277 ht_dump_statistics (hash_table *table) in ht_dump_statistics() argument
292 p = table->entries; in ht_dump_statistics()
293 limit = p + table->nslots; in ht_dump_statistics()
309 nelts = table->nelements; in ht_dump_statistics()
310 overhead = obstack_memory_used (&table->stack) - total_bytes; in ht_dump_statistics()
311 headers = table->nslots * sizeof (hashnode); in ht_dump_statistics()
318 (unsigned long) table->nslots); in ht_dump_statistics()
332 (double) table->collisions / (double) table->searches); in ht_dump_statistics()
334 (double) nelts / (double) table->searches); in ht_dump_statistics()