summaryrefslogtreecommitdiffstats
path: root/crypto/mem_dbg.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2000-01-18 09:30:51 +0000
committerRichard Levitte <levitte@openssl.org>2000-01-18 09:30:51 +0000
commita9188d4e173304948c7711566556602bfb3ee32f (patch)
treee9b4a390ef9692cc6212c8f1ae60a82cc8854f33 /crypto/mem_dbg.c
parentea5e7bcf632bba51618ab9407409b24cc4df8fa0 (diff)
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.
Diffstat (limited to 'crypto/mem_dbg.c')
-rw-r--r--crypto/mem_dbg.c20
1 files changed, 15 insertions, 5 deletions
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);
}