From a9188d4e173304948c7711566556602bfb3ee32f Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Tue, 18 Jan 2000 09:30:51 +0000 Subject: Compaq C 6.2 for VMS will complain when we want to convert non-function pointers to function pointers and vice versa. The current solution is to have unions that describe the conversion we want to do, and gives us the ability to extract the type of data we want. The current solution is a quick fix, and can probably be made in a more general or elegant way. --- crypto/mem_dbg.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'crypto/mem_dbg.c') diff --git a/crypto/mem_dbg.c b/crypto/mem_dbg.c index 6068dcc806..d084b8c6ca 100644 --- a/crypto/mem_dbg.c +++ b/crypto/mem_dbg.c @@ -661,21 +661,31 @@ void CRYPTO_mem_leaks(BIO *b) #endif } +union void_fn_to_char_u + { + char *char_p; + void (*fn_p)(); + }; + static void (*mem_cb)()=NULL; static void cb_leak(MEM *m, char *cb) { - void (*mem_callback)()=(void (*)())cb; - mem_callback(m->order,m->file,m->line,m->num,m->addr); + union void_fn_to_char_u mem_callback; + + mem_callback.char_p=cb; + mem_callback.fn_p(m->order,m->file,m->line,m->num,m->addr); } void CRYPTO_mem_leaks_cb(void (*cb)()) { + union void_fn_to_char_u mem_cb; + if (mh == NULL) return; CRYPTO_w_lock(CRYPTO_LOCK_MALLOC2); - mem_cb=cb; - lh_doall_arg(mh,(void (*)())cb_leak,(char *)mem_cb); - mem_cb=NULL; + mem_cb.fn_p=cb; + lh_doall_arg(mh,(void (*)())cb_leak,mem_cb.char_p); + mem_cb.char_p=NULL; CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC2); } -- cgit v1.2.3