diff options
author | José Fonseca <[email protected]> | 2008-03-18 12:46:24 +0000 |
---|---|---|
committer | José Fonseca <[email protected]> | 2008-03-18 17:20:56 +0000 |
commit | 527e30c53baadb396e5503e5188f0a9f1b2d2501 (patch) | |
tree | 07012ac7a9dff50b3bb8d9b405ae2c05d12c6774 | |
parent | d26139d6a19aaf8b4dbbaa1ee937fed2283923e4 (diff) |
d3d: Allow to iterate over the handle table.
-rw-r--r-- | src/gallium/auxiliary/util/u_handle_table.c | 22 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_handle_table.h | 9 |
2 files changed, 31 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_handle_table.c b/src/gallium/auxiliary/util/u_handle_table.c index fae4ac4039c..0bfb9e1b4ae 100644 --- a/src/gallium/auxiliary/util/u_handle_table.c +++ b/src/gallium/auxiliary/util/u_handle_table.c @@ -241,6 +241,28 @@ handle_table_remove(struct handle_table *ht, } +unsigned +handle_table_get_next_handle(struct handle_table *ht, + unsigned handle) +{ + unsigned index; + + for(index = handle; index < ht->size; ++index) { + if(!ht->objects[index]) + return index + 1; + } + + return 0; +} + + +unsigned +handle_table_get_first_handle(struct handle_table *ht) +{ + return handle_table_get_next_handle(ht, 0); +} + + void handle_table_destroy(struct handle_table *ht) { diff --git a/src/gallium/auxiliary/util/u_handle_table.h b/src/gallium/auxiliary/util/u_handle_table.h index a2f1f604ade..d080135c9f4 100644 --- a/src/gallium/auxiliary/util/u_handle_table.h +++ b/src/gallium/auxiliary/util/u_handle_table.h @@ -100,6 +100,15 @@ void handle_table_destroy(struct handle_table *ht); +unsigned +handle_table_get_first_handle(struct handle_table *ht); + + +unsigned +handle_table_get_next_handle(struct handle_table *ht, + unsigned handle); + + #ifdef __cplusplus } #endif |