diff options
author | Geoff Thorpe <geoff@openssl.org> | 2000-12-01 20:31:52 +0000 |
---|---|---|
committer | Geoff Thorpe <geoff@openssl.org> | 2000-12-01 20:31:52 +0000 |
commit | 385d81380cb8aa062b9d7e2c678419623c7db484 (patch) | |
tree | f866963b5b03410694d03a37d20695327a72a460 /crypto/mem_dbg.c | |
parent | 862e973b50e56d9510cfebc220cf410d3d5e99bc (diff) |
First step in tidying up the LHASH code. The callback prototypes (and
casts) used in the lhash code are about as horrible and evil as they can
be. For starters, the callback prototypes contain empty parameter lists.
Yuck.
This first change defines clearer prototypes - including "typedef"'d
function pointer types to use as "hash" and "compare" callbacks, as well as
the callbacks passed to the lh_doall and lh_doall_arg iteration functions.
Now at least more explicit (and clear) casting is required in all of the
dependant code - and that should be included in this commit.
The next step will be to hunt down and obliterate some of the function
pointer casting being used when it's not necessary - a particularly evil
variant exists in the implementation of lh_doall.
Diffstat (limited to 'crypto/mem_dbg.c')
-rw-r--r-- | crypto/mem_dbg.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/crypto/mem_dbg.c b/crypto/mem_dbg.c index 61329b098d..eb45516bdb 100644 --- a/crypto/mem_dbg.c +++ b/crypto/mem_dbg.c @@ -302,7 +302,8 @@ int CRYPTO_push_info_(const char *info, const char *file, int line) } if (amih == NULL) { - if ((amih=lh_new(app_info_hash,app_info_cmp)) == NULL) + if ((amih=lh_new((LHASH_HASH_FN_TYPE)app_info_hash, + (LHASH_COMP_FN_TYPE)app_info_cmp)) == NULL) { OPENSSL_free(ami); ret=0; @@ -394,7 +395,8 @@ void CRYPTO_dbg_malloc(void *addr, int num, const char *file, int line, } if (mh == NULL) { - if ((mh=lh_new(mem_hash,mem_cmp)) == NULL) + if ((mh=lh_new((LHASH_HASH_FN_TYPE)mem_hash, + (LHASH_COMP_FN_TYPE)mem_cmp)) == NULL) { OPENSSL_free(addr); OPENSSL_free(m); @@ -647,7 +649,8 @@ void CRYPTO_mem_leaks(BIO *b) ml.chunks=0; MemCheck_off(); /* obtains CRYPTO_LOCK_MALLOC2 */ if (mh != NULL) - lh_doall_arg(mh,(void (*)())print_leak,(char *)&ml); + lh_doall_arg(mh, (LHASH_DOALL_ARG_FN_TYPE)print_leak, + (char *)&ml); if (ml.chunks != 0) { sprintf(buf,"%ld bytes leaked in %d chunks\n", @@ -725,6 +728,6 @@ void CRYPTO_mem_leaks_cb(void (*cb)(unsigned long, const char *, int, int, void { if (mh == NULL) return; CRYPTO_w_lock(CRYPTO_LOCK_MALLOC2); - lh_doall_arg(mh,(void (*)())cb_leak,(void *)&cb); + lh_doall_arg(mh, (LHASH_DOALL_ARG_FN_TYPE)cb_leak,(void *)&cb); CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC2); } |