Lines Matching refs:entry
131 entry_is_free(const struct hash_entry *entry)
133 return entry->key == NULL;
137 entry_is_deleted(const struct hash_table *ht, struct hash_entry *entry)
139 return entry->key == ht->deleted_key;
143 entry_is_present(const struct hash_table *ht, struct hash_entry *entry)
145 return entry->key != NULL && entry->key != ht->deleted_key;
239 * If delete_function is passed, it gets called on each entry present before
244 void (*delete_function)(struct hash_entry *entry))
250 hash_table_foreach(ht, entry) {
251 delete_function(entry);
268 * If delete_function is passed, it gets called on each entry present.
272 void (*delete_function)(struct hash_entry *entry))
277 struct hash_entry *entry;
280 for (entry = ht->table; entry != ht->table + ht->size; entry++) {
281 if (entry_is_present(ht, entry))
282 delete_function(entry);
284 entry->key = NULL;
320 struct hash_entry *entry = ht->table + hash_address;
322 if (entry_is_free(entry)) {
324 } else if (entry_is_present(ht, entry) && entry->hash == hash) {
325 if (ht->key_equals_function(key, entry->key)) {
326 return entry;
339 * Finds a hash table entry with the given key and hash of that key.
341 * Returns NULL if no entry is found. Note that the data pointer may be
373 struct hash_entry *entry = ht->table + hash_address;
375 if (likely(entry->key == NULL)) {
376 entry->hash = hash;
377 entry->key = key;
378 entry->data = data;
420 hash_table_foreach(&old_ht, entry) {
421 hash_table_insert_rehash(ht, entry->hash, entry->key, entry->data);
449 struct hash_entry *entry = ht->table + hash_address;
451 if (!entry_is_present(ht, entry)) {
452 /* Stash the first available entry we find */
454 available_entry = entry;
455 if (entry_is_free(entry))
470 if (!entry_is_deleted(ht, entry) &&
471 entry->hash == hash &&
472 ht->key_equals_function(key, entry->key)) {
473 entry->key = key;
474 entry->data = data;
475 return entry;
521 * This function deletes the given hash table entry.
528 struct hash_entry *entry)
530 if (!entry)
533 entry->key = ht->deleted_key;
539 * Removes the entry with the corresponding key, if exists.
550 * Pass in NULL for the first entry, as in the start of a for loop.
553 _mesa_hash_table_next_entry_unsafe(const struct hash_table *ht, struct hash_entry *entry)
558 if (entry == NULL)
559 entry = ht->table;
561 entry = entry + 1;
562 if (entry != ht->table + ht->size)
563 return entry->key ? entry : _mesa_hash_table_next_entry_unsafe(ht, entry);
571 * Pass in NULL for the first entry, as in the start of a for loop. Note that
576 struct hash_entry *entry)
578 if (entry == NULL)
579 entry = ht->table;
581 entry = entry + 1;
583 for (; entry != ht->table + ht->size; entry++) {
584 if (entry_is_present(ht, entry)) {
585 return entry;
593 * Returns a random entry from the hash table.
602 bool (*predicate)(struct hash_entry *entry))
604 struct hash_entry *entry;
610 for (entry = ht->table + i; entry != ht->table + ht->size; entry++) {
611 if (entry_is_present(ht, entry) &&
612 (!predicate || predicate(entry))) {
613 return entry;
617 for (entry = ht->table; entry != ht->table + i; entry++) {
618 if (entry_is_present(ht, entry) &&
619 (!predicate || predicate(entry))) {
620 return entry;
797 _mesa_hash_table_u64_delete_key(struct hash_entry *entry)
802 struct hash_key_u64 *_key = (struct hash_key_u64 *)entry->key;
871 struct hash_entry *entry;
879 entry = hash_table_u64_search(ht, key);
880 if (!entry)
883 return entry->data;
889 struct hash_entry *entry;
901 entry = hash_table_u64_search(ht, key);
902 if (!entry)
906 _mesa_hash_table_remove(ht->table, entry);
908 struct hash_key *_key = (struct hash_key *)entry->key;
910 _mesa_hash_table_remove(ht->table, entry);