From 3c914840520161d9ca121d38973a79b050916a8a Mon Sep 17 00:00:00 2001 From: Geoff Thorpe Date: Tue, 9 Jan 2001 00:24:38 +0000 Subject: Move all the existing function pointer casts associated with LHASH's two "doall" functions to using type-safe wrappers. As and where required, this can be replaced by redeclaring the underlying callbacks to use the underlying "void"-based prototypes (eg. if performance suffers from an extra level of function invocation). --- crypto/conf/cnf_save.c | 7 ++++--- crypto/conf/conf_api.c | 6 ++++-- crypto/conf/conf_def.c | 4 +++- 3 files changed, 11 insertions(+), 6 deletions(-) (limited to 'crypto/conf') diff --git a/crypto/conf/cnf_save.c b/crypto/conf/cnf_save.c index efbb61373e..1439487526 100644 --- a/crypto/conf/cnf_save.c +++ b/crypto/conf/cnf_save.c @@ -59,7 +59,8 @@ #include #include -void print_conf(CONF_VALUE *cv); +static void print_conf(CONF_VALUE *cv); +static IMPLEMENT_LHASH_DOALL_FN(print_conf, CONF_VALUE *); main() { @@ -73,11 +74,11 @@ main() exit(1); } - lh_doall(conf,(LHASH_DOALL_FN_TYPE)print_conf); + lh_doall(conf,LHASH_DOALL_FN(print_conf)); } -void print_conf(CONF_VALUE *cv) +static void print_conf(CONF_VALUE *cv) { int i; CONF_VALUE *v; diff --git a/crypto/conf/conf_api.c b/crypto/conf/conf_api.c index bf84cecc1e..a0596bfd4a 100644 --- a/crypto/conf/conf_api.c +++ b/crypto/conf/conf_api.c @@ -70,6 +70,8 @@ static void value_free_hash(CONF_VALUE *a, LHASH *conf); static void value_free_stack(CONF_VALUE *a,LHASH *conf); +static IMPLEMENT_LHASH_DOALL_ARG_FN(value_free_hash, CONF_VALUE *, LHASH *) +static IMPLEMENT_LHASH_DOALL_ARG_FN(value_free_stack, CONF_VALUE *, LHASH *) /* We don't use function pointer casting or wrapper functions - but cast each * callback parameter inside the callback functions. */ /* static unsigned long hash(CONF_VALUE *v); */ @@ -198,13 +200,13 @@ void _CONF_free_data(CONF *conf) conf->data->down_load=0; /* evil thing to make sure the 'OPENSSL_free()' * works as expected */ - lh_doall_arg(conf->data, (LHASH_DOALL_ARG_FN_TYPE)value_free_hash, + lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(value_free_hash), conf->data); /* We now have only 'section' entries in the hash table. * Due to problems with */ - lh_doall_arg(conf->data, (LHASH_DOALL_ARG_FN_TYPE)value_free_stack, + lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(value_free_stack), conf->data); lh_free(conf->data); } diff --git a/crypto/conf/conf_def.c b/crypto/conf/conf_def.c index 1d30f6f771..59f9476dc6 100644 --- a/crypto/conf/conf_def.c +++ b/crypto/conf/conf_def.c @@ -710,9 +710,11 @@ static void dump_value(CONF_VALUE *a, BIO *out) BIO_printf(out, "[[%s]]\n", a->section); } +static IMPLEMENT_LHASH_DOALL_ARG_FN(dump_value, CONF_VALUE *, BIO *) + static int def_dump(CONF *conf, BIO *out) { - lh_doall_arg(conf->data, (LHASH_DOALL_ARG_FN_TYPE)dump_value, out); + lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(dump_value), out); return 1; } -- cgit v1.2.3