From 8755ad4c0b0652f16d3505ed72ed3d8310a35c6f Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Thu, 15 Mar 2018 21:37:11 +0100 Subject: removed *IFace from context --- code/ecp/htable/htable.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) (limited to 'code/ecp/htable') diff --git a/code/ecp/htable/htable.c b/code/ecp/htable/htable.c index 77f5a35..a46291b 100644 --- a/code/ecp/htable/htable.c +++ b/code/ecp/htable/htable.c @@ -1,37 +1,28 @@ #include +#include +#include #include "hashtable.h" -static void *h_create(ECPContext *ctx) { - return create_hashtable(1000, (unsigned int (*)(void *))ctx->cr.dh_pub_hash_fn, (int (*)(void *, void *))ctx->cr.dh_pub_hash_eq, NULL, NULL, NULL); +void *ecp_ht_create(ECPContext *ctx) { + return create_hashtable(1000, (unsigned int (*)(void *))ecp_cr_dh_pub_hash_fn, (int (*)(void *, void *))ecp_cr_dh_pub_hash_eq, NULL, NULL, NULL); } -static void h_destroy(void *h) { +void ecp_ht_destroy(void *h) { hashtable_destroy(h); } -static int h_insert(void *h, unsigned char *k, ECPConnection *v) { +int ecp_ht_insert(void *h, unsigned char *k, ECPConnection *v) { int rv = hashtable_insert(h, k, v); if (!rv) return ECP_ERR; return ECP_OK; } -static ECPConnection *h_remove(void *h, unsigned char *k) { +ECPConnection *ecp_ht_remove(void *h, unsigned char *k) { return hashtable_remove(h, k); } -static ECPConnection *h_search(void *h, unsigned char *k) { +ECPConnection *ecp_ht_search(void *h, unsigned char *k) { return hashtable_search(h, k); } -#ifdef ECP_WITH_HTABLE -int ecp_htable_init(ECPHTableIface *h) { - h->init = 1; - h->create = h_create; - h->destroy = h_destroy; - h->insert = h_insert; - h->remove = h_remove; - h->search = h_search; - return ECP_OK; -} -#endif \ No newline at end of file -- cgit v1.2.3