ghash: Add APIs to get hash table keys and values as GPtrArray

GPtrArray's are faster than lists and provide more flexibility, so add
APIs to get hash keys and values using these containers too.

Given that we know the size at array initialization we can optimize the
allocation quite a bit, making it faster than the API using GList both at
creation time and for consumers.
This commit is contained in:
Marco Trevisan (Treviño)
2022-12-14 03:18:44 +01:00
parent a0dbaeed2f
commit d2c3f7f513
4 changed files with 145 additions and 0 deletions

View File

@@ -2584,7 +2584,9 @@ g_hash_table_remove_all
g_hash_table_steal_all
g_hash_table_get_keys
g_hash_table_get_values
g_hash_table_get_values_as_ptr_array
g_hash_table_get_keys_as_array
g_hash_table_get_keys_as_ptr_array
GHRFunc
g_hash_table_freeze
g_hash_table_thaw