g_hash_table_lookup/g_hash_table_lookup_node bug
Created custom hash (GHashFunc) and equal (GEqualFunc) functions for g_hash_table_new_full implementation. Problem occurs when calling g_hash_table_lookup. The custom GEqualFunc callback is never executed because g_hash_table_lookup_node compares hash values and will skip the execution path to make the GEqualFunc call. This completely negates the purpose of being able to define your own GEqualFunc implementation.
The comments say this is done to avoid calling the "full-blow key equality function in most cases," but in reality this is for all cases. There is not alternative logic flow to execute the equality function if the "node_hash == hash_value" condition fails.
See glib/ghash.c lines 388 - 407; specifically lines 394 and thereafter:
while (!HASH_IS_UNUSED (node_hash))
{
/* We first check if our full hash values
* are equal so we can avoid calling the full-blown
* key equality function in most cases.
*/
if (node_hash == hash_value)
{
gpointer node_key = hash_table->keys[node_index];
if (hash_table->key_equal_func)
{
if (hash_table->key_equal_func (node_key, key))
return node_index;
}
else if (node_key == key)
{
return node_index;
}
}