util/hash_table: Clean up the _mesa_hash_table_clear() implementation.
Use the entry_is_present() helper to clarify what's going on with deletion, and then we can remove the special continue for NULL since we're just writing NULL anyway (which the CPU cache will elide for us). Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7244>
This commit is contained in:
@@ -250,10 +250,7 @@ _mesa_hash_table_clear(struct hash_table *ht,
|
||||
struct hash_entry *entry;
|
||||
|
||||
for (entry = ht->table; entry != ht->table + ht->size; entry++) {
|
||||
if (entry->key == NULL)
|
||||
continue;
|
||||
|
||||
if (delete_function != NULL && entry->key != ht->deleted_key)
|
||||
if (entry_is_present(ht, entry) && delete_function != NULL)
|
||||
delete_function(entry);
|
||||
|
||||
entry->key = NULL;
|
||||
|
Reference in New Issue
Block a user