aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/credentials/cred_encoding.c
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/libstrongswan/credentials/cred_encoding.c
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/libstrongswan/credentials/cred_encoding.c')
-rw-r--r--src/libstrongswan/credentials/cred_encoding.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/src/libstrongswan/credentials/cred_encoding.c b/src/libstrongswan/credentials/cred_encoding.c
index 53ac13cbb..303816391 100644
--- a/src/libstrongswan/credentials/cred_encoding.c
+++ b/src/libstrongswan/credentials/cred_encoding.c
@@ -94,22 +94,6 @@ bool cred_encoding_args(va_list args, ...)
return !failed;
}
-/**
- * hashtable hash() function
- */
-static u_int hash(void *key)
-{
- return (uintptr_t)key;
-}
-
-/**
- * hashtable equals() function
- */
-static bool equals(void *key1, void *key2)
-{
- return key1 == key2;
-}
-
METHOD(cred_encoding_t, get_cache, bool,
private_cred_encoding_t *this, cred_encoding_type_t type, void *cache,
chunk_t *encoding)
@@ -289,7 +273,8 @@ cred_encoding_t *cred_encoding_create()
for (type = 0; type < CRED_ENCODING_MAX; type++)
{
- this->cache[type] = hashtable_create(hash, equals, 8);
+ this->cache[type] = hashtable_create(hashtable_hash_ptr,
+ hashtable_equals_ptr, 8);
}
return &this->public;