forked from enlightenment/efl
eina: fix eina_hash_stringshared_new to actually compute the hash on the pointer.
Before this patch, the key would always be zero and the hash would solely rely on the rbtree to be efficient. This improve the situation by using the pointer as the key during hash computation.
This commit is contained in:
parent
29c6c3b95b
commit
e0807ce797
|
@ -490,6 +490,12 @@ _eina_hash_del_by_key(Eina_Hash *hash, const void *key, const void *data)
|
||||||
return _eina_hash_del_by_key_hash(hash, key, key_length, key_hash, data);
|
return _eina_hash_del_by_key_hash(hash, key, key_length, key_hash, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_eina_stringshared_hash(const void *key, int key_length EINA_UNUSED)
|
||||||
|
{
|
||||||
|
return eina_hash_superfast(&key, sizeof (void*));
|
||||||
|
}
|
||||||
|
|
||||||
static unsigned int
|
static unsigned int
|
||||||
_eina_string_key_length(const char *key)
|
_eina_string_key_length(const char *key)
|
||||||
{
|
{
|
||||||
|
@ -846,7 +852,7 @@ eina_hash_stringshared_new(Eina_Free_Cb data_free_cb)
|
||||||
{
|
{
|
||||||
return eina_hash_new(NULL,
|
return eina_hash_new(NULL,
|
||||||
EINA_KEY_CMP(_eina_stringshared_key_cmp),
|
EINA_KEY_CMP(_eina_stringshared_key_cmp),
|
||||||
EINA_KEY_HASH(eina_hash_superfast),
|
EINA_KEY_HASH(_eina_stringshared_hash),
|
||||||
data_free_cb,
|
data_free_cb,
|
||||||
EINA_HASH_BUCKET_SIZE);
|
EINA_HASH_BUCKET_SIZE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue