Mesa (master): mesa: silence void * / func * conversion warnings

Brian Paul brianp at kemper.freedesktop.org
Fri May 14 19:24:36 UTC 2010


Module: Mesa
Branch: master
Commit: e22e65d2230f8a1ec478147f786899cba14e4d3e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e22e65d2230f8a1ec478147f786899cba14e4d3e

Author: Brian Paul <brianp at vmware.com>
Date:   Thu May 13 16:38:58 2010 -0600

mesa: silence void * / func * conversion warnings

---

 src/mesa/main/dlopen.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/mesa/main/dlopen.c b/src/mesa/main/dlopen.c
index 658ac9e..57a3329 100644
--- a/src/mesa/main/dlopen.c
+++ b/src/mesa/main/dlopen.c
@@ -67,22 +67,27 @@ _mesa_dlopen(const char *libname, int flags)
 GenericFunc
 _mesa_dlsym(void *handle, const char *fname)
 {
+   union {
+      void *v;
+      GenericFunc f;
+   } u;
 #if defined(__blrts)
-   return (GenericFunc) NULL;
+   u.v = NULL;
 #elif defined(__DJGPP__)
    /* need '_' prefix on symbol names */
    char fname2[1000];
    fname2[0] = '_';
    strncpy(fname2 + 1, fname, 998);
    fname2[999] = 0;
-   return (GenericFunc) dlsym(handle, fname2);
+   u.v = dlsym(handle, fname2);
 #elif defined(_GNU_SOURCE)
-   return (GenericFunc) dlsym(handle, fname);
+   u.v = dlsym(handle, fname);
 #elif defined(__MINGW32__)
-   return (GenericFunc) GetProcAddress(handle, fname);
+   u.v = (void *) GetProcAddress(handle, fname);
 #else
-   return (GenericFunc) NULL;
+   u.v = NULL;
 #endif
+   return u.f;
 }
 
 




More information about the mesa-commit mailing list