It matters when it comes to unittest. The unittest code below may
cause an unintended result.
> char *library_name = g_strdup_printf("libhal-backend-%s-user-specific.so",
> info.backend_module_name_);
> int ret = hal_common_get_backend_with_library_name(info.module_,
(void **)&backend_module_data,
library_name);
Over the instantiated testcases, the g_strdup_printf() sometimes returns
same address containing different string. In this case, if the hash and
equal function are g_direct_hash() and g_direct_equal(), then it tests
those different string as equal because both strings are held by the
same address. Therefore, it is not enough to compare the starting
address but needs to compare the entire string.
Change-Id: Ifecbac1db3d03d61137e31b74e356ba0370c345d
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
if (_usage_count++ > 0)
return 0;
- _module_hash = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, _destroy_module_info);
+ _module_hash = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, _destroy_module_info);
return 0;
}