mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-14 00:06:24 +01:00
ghash: Clear out arguments to NULL in g_hash_table_lookup_extended()
If the given key is not found, clear the orig_key and value arguments to NULL as well as returning FALSE. Then the caller can unconditionally check them. This makes the behaviour of g_hash_table_lookup_extended() consistent with g_hash_table_steal_extended(). Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
parent
ea17d637c5
commit
8dc8b33dfa
@ -1190,7 +1190,14 @@ g_hash_table_lookup_extended (GHashTable *hash_table,
|
||||
node_index = g_hash_table_lookup_node (hash_table, lookup_key, &node_hash);
|
||||
|
||||
if (!HASH_IS_REAL (hash_table->hashes[node_index]))
|
||||
return FALSE;
|
||||
{
|
||||
if (orig_key != NULL)
|
||||
*orig_key = NULL;
|
||||
if (value != NULL)
|
||||
*value = NULL;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (orig_key)
|
||||
*orig_key = hash_table->keys[node_index];
|
||||
|
Loading…
Reference in New Issue
Block a user