aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libcharon/plugins/dhcp/dhcp_provider.c19
-rw-r--r--src/libcharon/plugins/eap_radius/eap_radius_forward.c22
-rw-r--r--src/libcharon/plugins/ha/ha_cache.c18
-rw-r--r--src/libstrongswan/credentials/cred_encoding.c19
4 files changed, 7 insertions, 71 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;
diff --git a/src/libcharon/plugins/eap_radius/eap_radius_forward.c b/src/libcharon/plugins/eap_radius/eap_radius_forward.c
index b873e1d69..54d52a98c 100644
--- a/src/libcharon/plugins/eap_radius/eap_radius_forward.c
+++ b/src/libcharon/plugins/eap_radius/eap_radius_forward.c
@@ -74,22 +74,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
*/
static void free_attribute(chunk_t *chunk)
@@ -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),
);
diff --git a/src/libcharon/plugins/ha/ha_cache.c b/src/libcharon/plugins/ha/ha_cache.c
index ce1afe6f9..60e75fc7e 100644
--- a/src/libcharon/plugins/ha/ha_cache.c
+++ b/src/libcharon/plugins/ha/ha_cache.c
@@ -59,22 +59,6 @@ struct private_ha_cache_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;
-}
-
-/**
* Cache entry for an IKE_SA
*/
typedef struct {
@@ -380,7 +364,7 @@ ha_cache_t *ha_cache_create(ha_kernel_t *kernel, ha_socket_t *socket,
.count = count,
.kernel = kernel,
.socket = socket,
- .cache = hashtable_create(hash, equals, 8),
+ .cache = hashtable_create(hashtable_hash_ptr, hashtable_equals_ptr, 8),
.mutex = mutex_create(MUTEX_TYPE_DEFAULT),
);
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;