Function
GLibHashTablefind
since: 2.4
Declaration [src]
gpointer
g_hash_table_find (
GHashTable* hash_table,
GHRFunc predicate,
gpointer user_data
)
Description [src]
Calls the given function for key/value pairs in the GHashTable
until predicate returns TRUE. The function is passed the key
and value of each pair, and the given user_data parameter. The
hash table may not be modified while iterating over it (you can’t
add/remove items).
Note, that hash tables are really only optimized for forward
lookups, i.e. g_hash_table_lookup(). So code that frequently issues
g_hash_table_find() or g_hash_table_foreach() (e.g. in the order of
once per every entry in a hash table) should probably be reworked
to use additional or different data structures for reverse lookups
(keep in mind that an O(n) find/foreach operation issued for all n
values in a hash table ends up needing O(n*n) operations).
Available since: 2.4
Parameters
hash_table-
Type:
GHashTableA
GHashTable.The data is owned by the caller of the function. predicate-
Type:
GHRFuncFunction to test the key/value pairs for a certain property.
user_data-
Type:
gpointerUser data to pass to the function.
The argument can be NULL.The data is owned by the caller of the function.