]> git.cworth.org Git - fips/commitdiff
Remove typedef for fips_glXGetProcAddressARB_t
authorCarl Worth <cworth@cworth.org>
Mon, 10 Jun 2013 21:34:26 +0000 (14:34 -0700)
committerCarl Worth <cworth@cworth.org>
Mon, 10 Jun 2013 21:47:41 +0000 (14:47 -0700)
There were two problems with this typedef. First, we don't actually
need it, (we define it here and then use it exactly once on the next
line---it's simpler to have the direct syntax for a function returning
a pointer to a function accepting void and returning void.

More importantly, the typedef was relying on the type __GLXextFuncPtr
being defined. This happens to work with Mesa on my system but is
inherently fragile. So the code is more robust not relying on this.

glxwrap.c

index 18ec3c107ccfad427ce4f694fb798c46bd441ae7..6da42e6622abf2a613f373e5db2ef0014c9d80bc 100644 (file)
--- a/glxwrap.c
+++ b/glxwrap.c
@@ -37,13 +37,16 @@ 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;
+       void *ptr;
+       static typeof(&glXGetProcAddressARB) glxwrap_real_glXGetProcAddressARB = NULL;
        char *name = "glXGetProcAddressARB";
 
        if (! glxwrap_real_glXGetProcAddressARB) {