mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 11:18:08 +02:00
d3d: Add function to walk through all items in the hash table.
This commit is contained in:
parent
56ac9eb1f6
commit
d26139d6a1
2 changed files with 27 additions and 1 deletions
|
|
@ -187,6 +187,28 @@ hash_table_remove(struct hash_table *ht,
|
|||
}
|
||||
|
||||
|
||||
enum pipe_error
|
||||
hash_table_foreach(struct hash_table *ht,
|
||||
enum pipe_error (*callback)(void *key, void *value, void *data),
|
||||
void *data)
|
||||
{
|
||||
struct cso_hash_iter iter;
|
||||
struct hash_table_item *item;
|
||||
enum pipe_error result;
|
||||
|
||||
iter = cso_hash_first_node(ht->cso);
|
||||
while (!cso_hash_iter_is_null(iter)) {
|
||||
item = (struct hash_table_item *)cso_hash_iter_data(iter);
|
||||
result = callback(item->key, item->value, data);
|
||||
if(result != PIPE_OK)
|
||||
return result;
|
||||
iter = cso_hash_iter_next(iter);
|
||||
}
|
||||
|
||||
return PIPE_OK;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
hash_table_destroy(struct hash_table *ht)
|
||||
{
|
||||
|
|
@ -196,4 +218,3 @@ hash_table_destroy(struct hash_table *ht)
|
|||
|
||||
FREE(ht);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -75,6 +75,11 @@ hash_table_remove(struct hash_table *ht,
|
|||
void *key);
|
||||
|
||||
|
||||
enum pipe_error
|
||||
hash_table_foreach(struct hash_table *ht,
|
||||
enum pipe_error (*callback)(void *key, void *value, void *data),
|
||||
void *data);
|
||||
|
||||
void
|
||||
hash_table_destroy(struct hash_table *ht);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue