Mesa (master): glapi: fix _glapi_get_proc_address() for mangled function names

Brian Paul brianp at kemper.freedesktop.org
Mon Apr 25 19:07:07 UTC 2016


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

Author: Frederic Devernay <frederic.devernay at m4x.org>
Date:   Mon Apr 25 10:39:43 2016 -0600

glapi: fix _glapi_get_proc_address() for mangled function names

In the dispatch table, all functions are stored without the "m" prefix.
Modify code so that OSMesaGetProcAddress works both with gl and mgl
prefixes. Similar to
https://lists.freedesktop.org/archives/mesa-dev/2015-September/095251.html

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94994
Cc: "11.1 11.2" <mesa-stable at lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp at vmware.com>

---

 src/mapi/glapi/glapi_getproc.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/src/mapi/glapi/glapi_getproc.c b/src/mapi/glapi/glapi_getproc.c
index 524a771..8f6f0a4 100644
--- a/src/mapi/glapi/glapi_getproc.c
+++ b/src/mapi/glapi/glapi_getproc.c
@@ -62,12 +62,7 @@ get_static_proc( const char * n )
    GLuint i;
    for (i = 0; static_functions[i].Name_offset >= 0; i++) {
       const char *testName = gl_string_table + static_functions[i].Name_offset;
-#ifdef MANGLE
-      /* skip the prefix on the name */
-      if (strcmp(testName, n + 1) == 0)
-#else
       if (strcmp(testName, n) == 0)
-#endif
       {
 	 return &static_functions[i];
       }
@@ -516,15 +511,14 @@ _glapi_get_proc_address(const char *funcName)
 
    init_glapi_relocs_once();
 
-#ifdef MANGLE
-   /* skip the prefix on the name */
-   if (funcName[1] != 'g' || funcName[2] != 'l')
-      return NULL;
-#else
-   if (funcName[0] != 'g' || funcName[1] != 'l')
-      return NULL;
+#ifdef USE_MGL_NAMESPACE
+   if (funcName && funcName[0] == 'm')
+      funcName++;
 #endif
 
+  if (!funcName || funcName[0] != 'g' || funcName[1] != 'l')
+      return NULL;
+
    /* search extension functions first */
    func = get_extension_proc_address(funcName);
    if (func)




More information about the mesa-commit mailing list