Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

external-libdrm: Commit

external/libdrm


Commit MetaInfo

Revision52ef6fbaf1962dac2a8b75078c20d65da90cfe8d (tree)
Time2018-05-26 01:12:00
AuthorJan Vesely <jan.vesely@rutg...>
CommiterJan Vesely

Log Message

amdgpu/util_hash_table: Add helper function to count the number of entries in hash table

Analogous to the mesa commit of the same name.
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

Change Summary

Incremental Difference

--- a/amdgpu/util_hash_table.c
+++ b/amdgpu/util_hash_table.c
@@ -237,6 +237,18 @@ drm_private void util_hash_table_foreach(struct util_hash_table *ht,
237237 }
238238 }
239239
240+static void util_hash_table_inc(void *k, void *v, void *d)
241+{
242+ ++*(size_t *)d;
243+}
244+
245+drm_private size_t util_hash_table_count(struct util_hash_table *ht)
246+{
247+ size_t count = 0;
248+ util_hash_table_foreach(ht, util_hash_table_inc, &count);
249+ return count;
250+}
251+
240252 drm_private void util_hash_table_destroy(struct util_hash_table *ht)
241253 {
242254 struct util_hash_iter iter;
--- a/amdgpu/util_hash_table.h
+++ b/amdgpu/util_hash_table.h
@@ -64,6 +64,8 @@ drm_private void util_hash_table_foreach(struct util_hash_table *ht,
6464 void (*callback)(void *key, void *value, void *data),
6565 void *data);
6666
67+drm_private size_t util_hash_table_count(struct util_hash_table *ht);
68+
6769 drm_private void util_hash_table_destroy(struct util_hash_table *ht);
6870
6971 #endif /* U_HASH_TABLE_H_ */
Show on old repository browser