util/hash_table: add _mesa_hash_table_num_entries

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
Nicolai Hähnle
2016-01-11 15:07:27 -05:00
parent 8b11d8cfbf
commit 55fb921d69
2 changed files with 6 additions and 3 deletions
+1 -3
View File
@@ -496,14 +496,12 @@ _mesa_HashFindFreeKeyBlock(struct _mesa_HashTable *table, GLuint numKeys)
GLuint
_mesa_HashNumEntries(const struct _mesa_HashTable *table)
{
struct hash_entry *entry;
GLuint count = 0;
if (table->deleted_key_data)
count++;
hash_table_foreach(table->ht, entry)
count++;
count += _mesa_hash_table_num_entries(table->ht);
return count;
}
+5
View File
@@ -69,6 +69,11 @@ void _mesa_hash_table_clear(struct hash_table *ht,
void _mesa_hash_table_set_deleted_key(struct hash_table *ht,
const void *deleted_key);
static inline uint32_t _mesa_hash_table_num_entries(struct hash_table *ht)
{
return ht->entries;
}
struct hash_entry *
_mesa_hash_table_insert(struct hash_table *ht, const void *key, void *data);
struct hash_entry *