diff --git a/common/getopt.c b/common/getopt.c index 74ef97d9..21ec6fb1 100644 --- a/common/getopt.c +++ b/common/getopt.c @@ -86,6 +86,11 @@ void getopt_option_destroy(getopt_option_t *goo) free(goo); } +void getopt_option_destroy_void(void *goo) +{ + getopt_option_destroy((getopt_option_t *)goo); +} + void getopt_destroy(getopt_t *gopt) { // free the extra arguments and container @@ -94,7 +99,7 @@ void getopt_destroy(getopt_t *gopt) // deep free of the getopt_option structs. Also frees key/values, so // after this loop, hash tables will no longer work - zarray_vmap(gopt->options, getopt_option_destroy); + zarray_vmap(gopt->options, getopt_option_destroy_void); zarray_destroy(gopt->options); // free tables diff --git a/common/getopt.h b/common/getopt.h index 69dbb05c..1f036628 100644 --- a/common/getopt.h +++ b/common/getopt.h @@ -38,6 +38,7 @@ typedef struct getopt getopt_t; getopt_t *getopt_create(); void getopt_destroy(getopt_t *gopt); +void getopt_option_destroy_void(void *goo); // Parse args. Returns 1 on success int getopt_parse(getopt_t *gopt, int argc, char *argv[], int showErrors); diff --git a/common/zarray.c b/common/zarray.c index 43e6a7e0..fa1f8a25 100644 --- a/common/zarray.c +++ b/common/zarray.c @@ -41,7 +41,7 @@ int zstrcmp(const void * a_pp, const void * b_pp) return strcmp(a,b); } -void zarray_vmap(zarray_t *za, void (*f)()) +void zarray_vmap(zarray_t *za, void (*f)(void*)) { assert(za != NULL); assert(f != NULL); diff --git a/common/zarray.h b/common/zarray.h index 22b4c2bb..1c9da4a6 100644 --- a/common/zarray.h +++ b/common/zarray.h @@ -355,7 +355,7 @@ static inline void zarray_map(zarray_t *za, void (*f)(void*)) * * void map_function(element_type *element) */ - void zarray_vmap(zarray_t *za, void (*f)()); + void zarray_vmap(zarray_t *za, void (*f)(void *)); /** * Removes all elements from the array and sets its size to zero. Pointers to diff --git a/common/zhash.c b/common/zhash.c index faf52233..b4a2ec09 100644 --- a/common/zhash.c +++ b/common/zhash.c @@ -352,7 +352,7 @@ void zhash_iterator_remove(zhash_iterator_t *zit) zit->last_entry--; } -void zhash_map_keys(zhash_t *zh, void (*f)()) +void zhash_map_keys(zhash_t *zh, void (*f)(void*)) { assert(zh != NULL); if (f == NULL) @@ -368,7 +368,7 @@ void zhash_map_keys(zhash_t *zh, void (*f)()) } } -void zhash_vmap_keys(zhash_t * zh, void (*f)()) +void zhash_vmap_keys(zhash_t * zh, void (*f)(void*)) { assert(zh != NULL); if (f == NULL) @@ -385,7 +385,7 @@ void zhash_vmap_keys(zhash_t * zh, void (*f)()) } } -void zhash_map_values(zhash_t * zh, void (*f)()) +void zhash_map_values(zhash_t * zh, void (*f)(void*)) { assert(zh != NULL); if (f == NULL) @@ -400,7 +400,7 @@ void zhash_map_values(zhash_t * zh, void (*f)()) } } -void zhash_vmap_values(zhash_t * zh, void (*f)()) +void zhash_vmap_values(zhash_t * zh, void (*f)(void*)) { assert(zh != NULL); if (f == NULL) diff --git a/common/zhash.h b/common/zhash.h index f3dee1aa..9993a66e 100644 --- a/common/zhash.h +++ b/common/zhash.h @@ -259,7 +259,7 @@ void zhash_iterator_remove(zhash_iterator_t *zit); * for the key, which the caller should not modify, as the hash table will not be * re-indexed. The function may be NULL, in which case no action is taken. */ -void zhash_map_keys(zhash_t *zh, void (*f)()); +void zhash_map_keys(zhash_t *zh, void (*f)(void *)); /** * Calls the supplied function with a pointer to every value in the hash table in @@ -267,7 +267,7 @@ void zhash_map_keys(zhash_t *zh, void (*f)()); * for the value, which the caller may safely modify. The function may be NULL, * in which case no action is taken. */ -void zhash_map_values(zhash_t *zh, void (*f)()); +void zhash_map_values(zhash_t *zh, void (*f)(void *)); /** * Calls the supplied function with a copy of every key in the hash table in @@ -280,7 +280,7 @@ void zhash_map_values(zhash_t *zh, void (*f)()); * Use with non-pointer keys (i.e. integer, double, etc.) will likely cause a * segmentation fault. */ -void zhash_vmap_keys(zhash_t *vh, void (*f)()); +void zhash_vmap_keys(zhash_t *vh, void (*f)(void *)); /** * Calls the supplied function with a copy of every value in the hash table in @@ -293,7 +293,7 @@ void zhash_vmap_keys(zhash_t *vh, void (*f)()); * Use with non-pointer values (i.e. integer, double, etc.) will likely cause a * segmentation fault. */ -void zhash_vmap_values(zhash_t *vh, void (*f)()); +void zhash_vmap_values(zhash_t *vh, void (*f)(void *)); /** * Returns an array which contains copies of all of the hash table's keys, in no diff --git a/common/zmaxheap.c b/common/zmaxheap.c index 7479f053..3ca30af7 100644 --- a/common/zmaxheap.c +++ b/common/zmaxheap.c @@ -167,7 +167,7 @@ void zmaxheap_add(zmaxheap_t *heap, void *p, float v) } } -void zmaxheap_vmap(zmaxheap_t *heap, void (*f)()) +void zmaxheap_vmap(zmaxheap_t *heap, void (*f)(void*)) { assert(heap != NULL); assert(f != NULL); diff --git a/common/zmaxheap.h b/common/zmaxheap.h index f0020f92..2f4a90d6 100644 --- a/common/zmaxheap.h +++ b/common/zmaxheap.h @@ -39,7 +39,7 @@ struct zmaxheap_iterator { zmaxheap_t *zmaxheap_create(size_t el_sz); -void zmaxheap_vmap(zmaxheap_t *heap, void (*f)()); +void zmaxheap_vmap(zmaxheap_t *heap, void (*f)(void *)); void zmaxheap_destroy(zmaxheap_t *heap);