From 4618ca82c37345a5823f5f59022c650f02cc6c0e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 20 Oct 2020 15:04:27 -0700 Subject: [PATCH] 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 Part-of: --- src/util/hash_table.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/util/hash_table.c b/src/util/hash_table.c index d27ba74b909..632d70230fc 100644 --- a/src/util/hash_table.c +++ b/src/util/hash_table.c @@ -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;