From ee37ac4da9303fb621b85c455505e91813f86922 Mon Sep 17 00:00:00 2001 From: Julian Daube Date: Wed, 25 Oct 2017 20:28:01 +0200 Subject: [PATCH] remove copy allocator, since it is not needed --- hashtable.h | 5 ++--- test_hashtable.c | 7 +++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/hashtable.h b/hashtable.h index b354521..ad4ce58 100644 --- a/hashtable.h +++ b/hashtable.h @@ -22,8 +22,6 @@ typedef struct entry * hashtable_iterator_t; // data deallocator typedef void(*hashtable_dealloc)(void*); -// data copy and allocator -typedef void(*hashtable_alloc)(void*); extern int key_compare(entry_key_t one, entry_key_t two); extern entry_hash_t key_hash(entry_key_t key); @@ -38,10 +36,11 @@ struct hashtable { struct entry * data; size_t len, count; - hashtable_alloc alloc_data; hashtable_dealloc dealloc_data; }; +extern void hashtable_init(struct hashtable * table); + extern hashtable_iterator_t hashtable_end(struct hashtable * table); /** diff --git a/test_hashtable.c b/test_hashtable.c index bc4c351..35d8b5c 100644 --- a/test_hashtable.c +++ b/test_hashtable.c @@ -42,6 +42,13 @@ void testadd() { pass(); } +volatile int number_copied = 0; + +void* test_copy(void * data) { + number_copied++; + return data; +} + void testget() { init("get");