mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 11:18:08 +02:00
gallium/auxiliary: Add helper function to count the number of entries in hash table
CC: <mesa-stable@lists.freedesktop.org> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
This commit is contained in:
parent
0defc55547
commit
d146768d13
2 changed files with 22 additions and 0 deletions
|
|
@ -270,6 +270,23 @@ util_hash_table_foreach(struct util_hash_table *ht,
|
|||
}
|
||||
|
||||
|
||||
static enum pipe_error
|
||||
util_hash_inc(void *k, void *v, void *d)
|
||||
{
|
||||
++*(size_t *)d;
|
||||
return PIPE_OK;
|
||||
}
|
||||
|
||||
|
||||
size_t
|
||||
util_hash_table_count(struct util_hash_table *ht)
|
||||
{
|
||||
size_t count = 0;
|
||||
util_hash_table_foreach(ht, util_hash_inc, &count);
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
util_hash_table_destroy(struct util_hash_table *ht)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -85,6 +85,11 @@ util_hash_table_foreach(struct util_hash_table *ht,
|
|||
(void *key, void *value, void *data),
|
||||
void *data);
|
||||
|
||||
|
||||
size_t
|
||||
util_hash_table_count(struct util_hash_table *ht);
|
||||
|
||||
|
||||
void
|
||||
util_hash_table_destroy(struct util_hash_table *ht);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue