diff options
author | Uros Majstorovic <majstor@majstor.org> | 2022-01-31 06:29:17 +0100 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2022-01-31 06:29:17 +0100 |
commit | dd19d6f5c7e0b335301a3f3e3d21bffb8c83e558 (patch) | |
tree | 0841609c7e1c56cf95419d98c0074e6a2768acda /ecp | |
parent | 9f5c5c6263383cc7d6fb03f949465df5a02734b1 (diff) |
hashtable bugfix
Diffstat (limited to 'ecp')
-rw-r--r-- | ecp/src/htable/Makefile | 4 | ||||
-rwxr-xr-x | ecp/src/htable/hashtable.c | 3 | ||||
-rwxr-xr-x | ecp/src/htable/hashtable_itr.c | 1 | ||||
-rw-r--r-- | ecp/src/htable/htable.c | 5 |
4 files changed, 6 insertions, 7 deletions
diff --git a/ecp/src/htable/Makefile b/ecp/src/htable/Makefile index 7ef95d5..76a4efd 100644 --- a/ecp/src/htable/Makefile +++ b/ecp/src/htable/Makefile @@ -1,5 +1,5 @@ -include ../Makefile.platform -CFLAGS += $(PIC) -I.. -std=gnu89 +include ../platform.mk +CFLAGS += -I.. -std=gnu89 obj = htable.o hashtable.o hashtable_itr.o diff --git a/ecp/src/htable/hashtable.c b/ecp/src/htable/hashtable.c index 1891f1b..36c8a6d 100755 --- a/ecp/src/htable/hashtable.c +++ b/ecp/src/htable/hashtable.c @@ -217,6 +217,7 @@ hashtable_remove(struct hashtable *h, void *k) struct entry *e; void *v; e = hashtable_remove_static(h,k); + if (NULL == e) return NULL; v = e->v; freekey(e->k); free(e); @@ -240,7 +241,7 @@ hashtable_remove_static(struct hashtable *h, void *k) { *pE = e->next; h->entrycount--; - return e->v; + return e; } pE = &(e->next); e = e->next; diff --git a/ecp/src/htable/hashtable_itr.c b/ecp/src/htable/hashtable_itr.c index 51ce0d2..e77bbb0 100755 --- a/ecp/src/htable/hashtable_itr.c +++ b/ecp/src/htable/hashtable_itr.c @@ -104,6 +104,7 @@ hashtable_iterator_remove(struct hashtable_itr *itr) int ret; e = hashtable_iterator_entry(itr); + if (NULL == e) return 0; /* stupidity check */ ret = hashtable_iterator_remove_static(itr); freekey(e->k); free(e); diff --git a/ecp/src/htable/htable.c b/ecp/src/htable/htable.c index 1fa79a3..104d2aa 100644 --- a/ecp/src/htable/htable.c +++ b/ecp/src/htable/htable.c @@ -5,10 +5,7 @@ #include "hashtable.h" void *ecp_ht_create(ECPContext *ctx) { - printf("NEFORE CREATE\n"); - void *r = hashtable_create(1000, (unsigned int (*)(void *))ecp_cr_dh_pub_hash_fn, (int (*)(void *, void *))ecp_cr_dh_pub_hash_eq); - printf("AFTER CREATE\n"); - return r; + return hashtable_create(1000, (unsigned int (*)(void *))ecp_cr_dh_pub_hash_fn, (int (*)(void *, void *))ecp_cr_dh_pub_hash_eq); } void ecp_ht_destroy(void *h) { |