From 365d91a86f3fa0092896804ca6d6c1b83f2b253a Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sun, 13 Apr 2008 18:20:18 +0200 Subject: [PATCH] patricia: remove ugly abuse of K&R style function declaration It left the argument types unspecified in a function pointer, then called it using different numbers of arguments. libratbox r25229 --- libratbox/include/rb_patricia.h | 7 +++---- libratbox/src/patricia.c | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/libratbox/include/rb_patricia.h b/libratbox/include/rb_patricia.h index c24e0797..353b301b 100644 --- a/libratbox/include/rb_patricia.h +++ b/libratbox/include/rb_patricia.h @@ -26,7 +26,6 @@ #endif /* typedef unsigned int u_int; */ -typedef void (*void_fn_t) (); #define rb_prefix_touchar(prefix) ((unsigned char *)&(prefix)->add.sin) #define MAXLINE 1024 #define BIT_TEST(f, b) ((f) & (b)) @@ -79,9 +78,9 @@ rb_patricia_node_t *rb_patricia_lookup(rb_patricia_tree_t * patricia, rb_prefix_ void rb_patricia_remove(rb_patricia_tree_t * patricia, rb_patricia_node_t * node); rb_patricia_tree_t *rb_new_patricia(int maxbits); -void rb_clear_patricia(rb_patricia_tree_t * patricia, void_fn_t func); -void rb_destroy_patricia(rb_patricia_tree_t * patricia, void_fn_t func); -void rb_patricia_process(rb_patricia_tree_t * patricia, void_fn_t func); +void rb_clear_patricia(rb_patricia_tree_t * patricia, void (*func)(void *)); +void rb_destroy_patricia(rb_patricia_tree_t * patricia, void (*func)(void *)); +void rb_patricia_process(rb_patricia_tree_t * patricia, void (*func)(rb_prefix_t *, void *)); void rb_init_patricia(void); diff --git a/libratbox/src/patricia.c b/libratbox/src/patricia.c index bcfe678e..9e92bb34 100644 --- a/libratbox/src/patricia.c +++ b/libratbox/src/patricia.c @@ -287,7 +287,7 @@ rb_new_patricia(int maxbits) */ void -rb_clear_patricia(rb_patricia_tree_t * patricia, void_fn_t func) +rb_clear_patricia(rb_patricia_tree_t * patricia, void (*func)(void *)) { assert(patricia); if(patricia->head) @@ -343,7 +343,7 @@ rb_clear_patricia(rb_patricia_tree_t * patricia, void_fn_t func) void -rb_destroy_patricia(rb_patricia_tree_t * patricia, void_fn_t func) +rb_destroy_patricia(rb_patricia_tree_t * patricia, void (*func)(void *)) { rb_clear_patricia(patricia, func); num_active_patricia--; @@ -355,7 +355,7 @@ rb_destroy_patricia(rb_patricia_tree_t * patricia, void_fn_t func) */ void -rb_patricia_process(rb_patricia_tree_t * patricia, void_fn_t func) +rb_patricia_process(rb_patricia_tree_t * patricia, void (*func)(rb_prefix_t *, void *)) { rb_patricia_node_t *node; assert(func);