Properly hash pointers for hash tables where appropriate

Simply using the pointer is not optimal for our hash table
implementation, which simply masks the key to determine the bucket.
This commit is contained in:
Tobias Brunner
2014-03-31 14:32:44 +02:00
parent 7522fcffd2
commit 3b09c02ec0
4 changed files with 7 additions and 71 deletions
@@ -73,22 +73,6 @@ typedef struct {
*/
static private_eap_radius_forward_t *singleton = NULL;
/**
* Hashtable hash function
*/
static u_int hash(uintptr_t key)
{
return key;
}
/**
* Hashtable equals function
*/
static bool equals(uintptr_t a, uintptr_t b)
{
return a == b;
}
/**
* Free a queue entry
*/
@@ -442,10 +426,8 @@ eap_radius_forward_t *eap_radius_forward_create()
.to_attr = parse_selector(lib->settings->get_str(lib->settings,
"%s.plugins.eap-radius.forward.radius_to_ike", "",
lib->ns)),
.from = hashtable_create((hashtable_hash_t)hash,
(hashtable_equals_t)equals, 8),
.to = hashtable_create((hashtable_hash_t)hash,
(hashtable_equals_t)equals, 8),
.from = hashtable_create(hashtable_hash_ptr, hashtable_equals_ptr, 8),
.to = hashtable_create(hashtable_hash_ptr, hashtable_equals_ptr, 8),
.mutex = mutex_create(MUTEX_TYPE_DEFAULT),
);