summaryrefslogtreecommitdiff
path: root/code/core/htable/htable.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2017-08-03 05:40:23 +0200
committerUros Majstorovic <majstor@majstor.org>2017-08-03 05:40:23 +0200
commit72520c7339f04849633114d9dca644e32f85e9fb (patch)
tree2c931544be4d63c3eabf02b4ca68a1eb444c5cc0 /code/core/htable/htable.c
parent43c30eec5196fa8ace45cc703fffe38c69563220 (diff)
implemented mtype return mask; fixed nasty ctype bug in conn create
Diffstat (limited to 'code/core/htable/htable.c')
-rw-r--r--code/core/htable/htable.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/code/core/htable/htable.c b/code/core/htable/htable.c
index 4a9ee11..552a03b 100644
--- a/code/core/htable/htable.c
+++ b/code/core/htable/htable.c
@@ -3,33 +3,17 @@
#include <string.h>
#include "hashtable.h"
-#include "hashtable_private.h"
-
-static unsigned int hash_fn(void *k) {
- return *((unsigned int *)k);
-}
-
-static int eq_fn(void *k1, void *k2) {
- return !memcmp(k1, k2, ECP_ECDH_SIZE_KEY);
-}
static void *h_create(ECPContext *ctx) {
int rv;
- struct hashtable *h = malloc(sizeof(struct hashtable));
+ struct hashtable *h = create_hashtable(1000, (unsigned int (*)(void *))ctx->cr.dh_pub_hash_fn, (int (*)(void *, void *))ctx->cr.dh_pub_hash_eq, NULL, NULL, NULL);
if (h == NULL) return NULL;
- rv = create_hashtable(h, 1000, (unsigned int (*)(void *))ctx->cr.dh_pub_hash_fn, (int (*)(void *, void *))ctx->cr.dh_pub_hash_eq, NULL, NULL, NULL);
- if (!rv) {
- free(h);
- return NULL;
- }
-
return h;
}
static void h_destroy(void *h) {
hashtable_destroy(h);
- free(h);
}
static int h_insert(void *h, unsigned char *k, ECPConnection *v) {
@@ -39,6 +23,7 @@ static int h_insert(void *h, unsigned char *k, ECPConnection *v) {
}
static ECPConnection *h_remove(void *h, unsigned char *k) {
+ printf("REMOVE!!!\n");
return hashtable_remove(h, k);
}