Lines Matching refs:table

59   cpp_hash_table *table;  in ht_create()  local
61 table = XCNEW (cpp_hash_table); in ht_create()
64 obstack_specify_allocation (&table->stack, 0, 0, xmalloc, free); 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 (cpp_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()
91 ht_lookup (cpp_hash_table *table, const unsigned char *str, size_t len, in ht_lookup() argument
94 return ht_lookup_with_hash (table, str, len, calc_hash (str, len), in ht_lookup()
99 ht_lookup_with_hash (cpp_hash_table *table, const unsigned char *str, in ht_lookup_with_hash() argument
105 unsigned int deleted_index = table->nslots; in ht_lookup_with_hash()
109 sizemask = table->nslots - 1; in ht_lookup_with_hash()
111 table->searches++; in ht_lookup_with_hash()
113 node = table->entries[index]; in ht_lookup_with_hash()
130 table->collisions++; in ht_lookup_with_hash()
132 node = table->entries[index]; in ht_lookup_with_hash()
138 if (deleted_index != table->nslots) in ht_lookup_with_hash()
152 if (deleted_index != table->nslots) in ht_lookup_with_hash()
155 node = (*table->alloc_node) (table); in ht_lookup_with_hash()
156 table->entries[index] = node; in ht_lookup_with_hash()
161 if (table->alloc_subobject) in ht_lookup_with_hash()
163 char *chars = (char *) table->alloc_subobject (len + 1); in ht_lookup_with_hash()
169 HT_STR (node) = (const unsigned char *) obstack_copy0 (&table->stack, in ht_lookup_with_hash()
172 if (++table->nelements * 4 >= table->nslots * 3) in ht_lookup_with_hash()
174 ht_expand (table); in ht_lookup_with_hash()
182 ht_expand (cpp_hash_table *table) in ht_expand() argument
187 size = table->nslots * 2; in ht_expand()
191 p = table->entries; in ht_expand()
192 limit = p + table->nslots; in ht_expand()
214 if (table->entries_owned) in ht_expand()
215 free (table->entries); in ht_expand()
216 table->entries_owned = true; in ht_expand()
217 table->entries = nentries; in ht_expand()
218 table->nslots = size; in ht_expand()
224 ht_forall (cpp_hash_table *table, ht_cb cb, const void *v) in ht_forall() argument
228 p = table->entries; in ht_forall()
229 limit = p + table->nslots; in ht_forall()
233 if ((*cb) (table->pfile, *p, v) == 0) in ht_forall()
242 ht_purge (cpp_hash_table *table, ht_cb cb, const void *v) in ht_purge() argument
246 p = table->entries; in ht_purge()
247 limit = p + table->nslots; in ht_purge()
251 if ((*cb) (table->pfile, *p, v)) in ht_purge()
274 ht_dump_statistics (cpp_hash_table *table) in ht_dump_statistics() argument
289 p = table->entries; in ht_dump_statistics()
290 limit = p + table->nslots; in ht_dump_statistics()
306 nelts = table->nelements; in ht_dump_statistics()
307 overhead = obstack_memory_used (&table->stack) - total_bytes; in ht_dump_statistics()
308 headers = table->nslots * sizeof (hashnode); in ht_dump_statistics()
315 (unsigned long) table->nslots); in ht_dump_statistics()
329 (double) table->collisions / (double) table->searches); in ht_dump_statistics()
331 (double) nelts / (double) table->searches); in ht_dump_statistics()