mesa: Open-code hash walk in _mesa_HashPrint

Previously the deleted key data would get printed at the beginning and
the end.  I don't think that was intentional, so I changed it.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7171>
This commit is contained in:
Ian Romanick 2020-10-12 16:44:18 -07:00 committed by Marge Bot
parent 3c2489d2e4
commit 0e17bb509e

View file

@ -378,23 +378,21 @@ _mesa_HashWalkLocked(const struct _mesa_HashTable *table,
hash_walk_unlocked(table, callback, userData);
}
static void
debug_print_entry(GLuint key, void *data, void *userData)
{
_mesa_debug(NULL, "%u %p\n", key, data);
}
/**
* Dump contents of hash table for debugging.
*
*
* \param table the hash table.
*/
void
_mesa_HashPrint(const struct _mesa_HashTable *table)
{
if (table->deleted_key_data)
debug_print_entry(DELETED_KEY_VALUE, table->deleted_key_data, NULL);
_mesa_HashWalk(table, debug_print_entry, NULL);
_mesa_debug(NULL, "%u %p\n", DELETED_KEY_VALUE, table->deleted_key_data);
hash_table_foreach(table->ht, entry) {
_mesa_debug(NULL, "%u %p\n", (unsigned)(uintptr_t) entry->key,
entry->data);
}
}