]> git.cworth.org Git - fips/blobdiff - glxwrap.c
configure: Test whether compiler can create both 32 and 64-bit binaries
[fips] / glxwrap.c
index 18ec3c107ccfad427ce4f694fb798c46bd441ae7..84bf48522565e489de274cd87e752d5a470ebd01 100644 (file)
--- a/glxwrap.c
+++ b/glxwrap.c
@@ -37,29 +37,23 @@ glXSwapBuffers (Display *dpy, GLXDrawable drawable)
        metrics_end_frame ();
 }
 
-
-typedef __GLXextFuncPtr (* fips_glXGetProcAddressARB_t)(const GLubyte *func);
-__GLXextFuncPtr
-glXGetProcAddressARB (const GLubyte *func)
+/* glXGetProcAddressARB is a function which accepts a string and
+ * returns a generic function pointer (which nominall accepts void and
+ * has void return type). Of course, the user is expected to cast the
+ * returned function pointer to a function pointer of the expected
+ * type.
+ */
+void (*glXGetProcAddressARB (const GLubyte *func))(void)
 {
-       __GLXextFuncPtr ptr;
-       static fips_glXGetProcAddressARB_t glxwrap_real_glXGetProcAddressARB = NULL;
-       char *name = "glXGetProcAddressARB";
-
-       if (! glxwrap_real_glXGetProcAddressARB) {
-               glxwrap_real_glXGetProcAddressARB = glwrap_lookup (name);
-               if (! glxwrap_real_glXGetProcAddressARB) {
-                       fprintf (stderr, "Error: Failed to find function %s.\n",
-                                name);
-                       return NULL;
-               }
-       }
+       void *ret;
 
        /* If our library has this symbol, that's what we want to give. */
-       ptr = dlwrap_real_dlsym (NULL, (const char *) func);
-       if (ptr)
-               return ptr;
+       ret = dlwrap_real_dlsym (NULL, (const char *) func);
+       if (ret)
+               return ret;
 
        /* Otherwise, just defer to the real glXGetProcAddressARB. */
-       return glxwrap_real_glXGetProcAddressARB (func);
+       GLWRAP_DEFER_WITH_RETURN (ret, glXGetProcAddressARB, func);
+
+       return ret;
 }