From: Carl Worth Date: Mon, 10 Jun 2013 21:34:26 +0000 (-0700) Subject: Remove typedef for fips_glXGetProcAddressARB_t X-Git-Url: https://git.cworth.org/git?p=fips;a=commitdiff_plain;h=377222f13763b1b7b78bf558ab9ac8b70535c96d Remove typedef for fips_glXGetProcAddressARB_t 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. --- diff --git a/glxwrap.c b/glxwrap.c index 18ec3c1..6da42e6 100644 --- 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) {