Lines Matching defs:table

1 /* hash - implement simple hashing table with string based keys.
86 /* Initialize a hash table. INIT_SIZE > 1 is the initial number of available
99 htab->table = (hash_entry *) xcalloc (init_size + 1, sizeof (hash_entry));
107 /* Delete a hash table's contents.
112 free (htab->table);
144 /* Look up a given key in the hash table.
154 hash_entry *table = htab->table;
161 if (table[idx].used)
163 if (table[idx].used == hval && table[idx].keylen == keylen
164 && memcmp (table[idx].key, key, keylen) == 0)
178 if (table[idx].used == hval && table[idx].keylen == keylen
179 && memcmp (table[idx].key, key, keylen) == 0)
182 while (table[idx].used);
188 /* Look up the value of a key in the given table.
194 hash_entry *table = htab->table;
197 if (table[idx].used == 0)
200 *result = table[idx].data;
205 /* Insert the pair (KEY[0..KEYLEN-1], DATA) in the hash table at index IDX.
206 HVAL is the key's hash code. IDX depends on it. The table entry at index
213 hash_entry *table = htab->table;
215 table[idx].used = hval;
216 table[idx].key = key;
217 table[idx].keylen = keylen;
218 table[idx].data = data;
223 table[idx].next = &table[idx];
224 htab->first = &table[idx];
228 table[idx].next = htab->first->next;
229 htab->first->next = &table[idx];
230 htab->first = &table[idx];
237 /* Grow the hash table. */
242 hash_entry *table = htab->table;
248 htab->table = (hash_entry *) xcalloc (1 + htab->size, sizeof (hash_entry));
251 if (table[idx].used)
252 insert_entry_2 (htab, table[idx].key, table[idx].keylen,
253 table[idx].used,
254 lookup (htab, table[idx].key, table[idx].keylen,
255 table[idx].used),
256 table[idx].data);
258 free (table);
262 /* Try to insert the pair (KEY[0..KEYLEN-1], DATA) in the hash table.
263 Return non-NULL (more precisely, the address of the KEY inside the table's
272 hash_entry *table = htab->table;
275 if (table[idx].used)
284 /* Table is filled more than 75%. Resize the table. */
291 /* Insert the pair (KEY[0..KEYLEN-1], DATA) in the hash table.
299 hash_entry *table = htab->table;
302 if (table[idx].used)
305 table[idx].data = data;
314 /* Table is filled more than 75%. Resize the table. */
321 /* Steps *PTR forward to the next used entry in the given hash table. *PTR
324 Return 0 normally, -1 when the whole hash table has been traversed. */
353 /* Steps *PTR forward to the next used entry in the given hash table. *PTR
357 Return 0 normally, -1 when the whole hash table has been traversed. */