Mesa (master): apple: Use apple_cgl_get_dl_handle() rather than opening a new handle

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Fri Jun 17 19:29:51 UTC 2011


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

Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Wed Jun 15 00:22:00 2011 -0700

apple: Use apple_cgl_get_dl_handle() rather than opening a new handle

Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

---

 src/glx/apple/apple_glapi.c |   24 ++----------------------
 1 files changed, 2 insertions(+), 22 deletions(-)

diff --git a/src/glx/apple/apple_glapi.c b/src/glx/apple/apple_glapi.c
index 0c89f46..34f726e 100644
--- a/src/glx/apple/apple_glapi.c
+++ b/src/glx/apple/apple_glapi.c
@@ -44,38 +44,18 @@
 
 #include "apple_glx.h"
 #include "apple_xgl_api.h"
-
-#ifndef OPENGL_FRAMEWORK_PATH
-#define OPENGL_FRAMEWORK_PATH "/System/Library/Frameworks/OpenGL.framework/OpenGL"
-#endif
+#include "apple_cgl.h"
 
 struct _glapi_table * __ogl_framework_api = NULL;
 struct _glapi_table * __applegl_api = NULL;
 
 void apple_glapi_set_dispatch(void) {
-    static void *handle;
-    const char *opengl_framework_path;
-
     if(__applegl_api)  {
         _glapi_set_dispatch(__applegl_api);
         return;
     }
 
-    opengl_framework_path = getenv("OPENGL_FRAMEWORK_PATH");
-    if (!opengl_framework_path) {
-        opengl_framework_path = OPENGL_FRAMEWORK_PATH;
-    }
-
-    (void) dlerror();            /*drain dlerror */
-    handle = dlopen(opengl_framework_path, RTLD_LOCAL);
-
-    if (!handle) {
-        fprintf(stderr, "error: unable to dlopen %s : %s\n",
-                opengl_framework_path, dlerror());
-        abort();
-    }
-
-    __ogl_framework_api = _glapi_create_table_from_handle(handle, "gl");
+    __ogl_framework_api = _glapi_create_table_from_handle(apple_cgl_get_dl_handle(), "gl");
     assert(__ogl_framework_api);
 
     __applegl_api = malloc(sizeof(struct _glapi_table));




More information about the mesa-commit mailing list