aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcharon/plugins/dhcp
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2014-03-27 11:37:16 +0100
committerTobias Brunner <tobias@strongswan.org>2014-03-31 14:32:44 +0200
commit3b09c02ec05a4dc1810717cb123c93cc753f7d8a (patch)
tree37535e6cdfc2da42e6b0b5f4f1cc13b1922a3e75 /src/libcharon/plugins/dhcp
parent7522fcffd26b96031cc4efc88b1ceb1220459f4d (diff)
downloadstrongswan-3b09c02ec05a4dc1810717cb123c93cc753f7d8a.tar.bz2
strongswan-3b09c02ec05a4dc1810717cb123c93cc753f7d8a.tar.xz
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.
Diffstat (limited to 'src/libcharon/plugins/dhcp')
-rw-r--r--src/libcharon/plugins/dhcp/dhcp_provider.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/src/libcharon/plugins/dhcp/dhcp_provider.c b/src/libcharon/plugins/dhcp/dhcp_provider.c
index e092771f4..f5325b566 100644
--- a/src/libcharon/plugins/dhcp/dhcp_provider.c
+++ b/src/libcharon/plugins/dhcp/dhcp_provider.c
@@ -47,22 +47,6 @@ struct private_dhcp_provider_t {
};
/**
- * Hashtable hash function
- */
-static u_int hash(void *key)
-{
- return (uintptr_t)key;
-}
-
-/**
- * Hashtable equals function
- */
-static bool equals(void *a, void *b)
-{
- return a == b;
-}
-
-/**
* Hash ID and host to a key
*/
static uintptr_t hash_id_host(identification_t *id, host_t *host)
@@ -226,7 +210,8 @@ dhcp_provider_t *dhcp_provider_create(dhcp_socket_t *socket)
},
.socket = socket,
.mutex = mutex_create(MUTEX_TYPE_DEFAULT),
- .transactions = hashtable_create(hash, equals, 8),
+ .transactions = hashtable_create(hashtable_hash_ptr,
+ hashtable_equals_ptr, 8),
);
return &this->public;