From e98a6d32d71d96261f84fa5f6e585e191cbd7cc0 Mon Sep 17 00:00:00 2001 From: Brian Barrett Date: Fri, 30 Sep 2005 05:15:27 +0000 Subject: [PATCH] * fix compiler warning about void* -> function pointer casting. Stupid compilers and return type of dlsym() This commit was SVN r7552. --- .../memory_malloc_interpose.c | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/opal/mca/memory/malloc_interpose/memory_malloc_interpose.c b/opal/mca/memory/malloc_interpose/memory_malloc_interpose.c index 9f2668d32c..a7c7b7ba26 100644 --- a/opal/mca/memory/malloc_interpose/memory_malloc_interpose.c +++ b/opal/mca/memory/malloc_interpose/memory_malloc_interpose.c @@ -57,21 +57,36 @@ const opal_memory_base_component_1_0_0_t mca_memory_malloc_interpose_component = #define FIND_REALFREE() \ do { \ if (NULL == realfree) { \ - realfree = (void (*)(void*)) dlsym(RTLD_NEXT, "free"); \ + union { \ + void (*free_fp)(void*); \ + void *free_p; \ + } tmp; \ + tmp.free_p = dlsym(RTLD_NEXT, "free"); \ + realfree = tmp.free_fp; \ } \ } while (0); #define FIND_REALREALLOC() \ do { \ if (NULL == realrealloc) { \ - realrealloc = (void* (*)(void*, size_t)) dlsym(RTLD_NEXT, "realloc"); \ + union { \ + void* (*realloc_fp)(void*, size_t); \ + void* realloc_p; \ + } tmp; \ + tmp.realloc_p = dlsym(RTLD_NEXT, "realloc"); \ + realrealloc = tmp.realloc_fp; \ } \ } while (0); #define FIND_REALMUNMAP() \ do { \ if (NULL == realmunmap) { \ - realmunmap = (int (*)(void*, size_t)) dlsym(RTLD_NEXT, "munmap"); \ + union { \ + int (*munmap_fp)(void*, size_t); \ + void *munmap_p; \ + } tmp; \ + tmp.munmap_p = dlsym(RTLD_NEXT, "munmap"); \ + realmunmap = tmp.munmap_fp; \ } \ } while (0);