summaryrefslogtreecommitdiff
path: root/src/libEGL.c
diff options
context:
space:
mode:
authorJari Vetoniemi <mailroxas@gmail.com>2018-03-02 18:05:27 +0200
committerJari Vetoniemi <mailroxas@gmail.com>2018-03-02 18:05:27 +0200
commit24dabae964c280d2cbce84a4e5fa446abf658b77 (patch)
tree65591872a409066d2b8d765a34dff4a80755e4d0 /src/libEGL.c
parent8d8fde396c896f872deef0fdaa0afc09702a2305 (diff)
libEGL: Use unions for function ptrs
Diffstat (limited to 'src/libEGL.c')
-rw-r--r--src/libEGL.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libEGL.c b/src/libEGL.c
index da858bc..74c076d 100644
--- a/src/libEGL.c
+++ b/src/libEGL.c
@@ -11,16 +11,16 @@ struct ANativeWindow {
EGLDisplay
eglGetDisplay(EGLNativeDisplayType native_display)
{
- static EGLDisplay (*orig_eglGetDisplay)(EGLNativeDisplayType native_display);
- if (!orig_eglGetDisplay) orig_eglGetDisplay = dlsym(RTLD_NEXT, "eglGetDisplay");
- return orig_eglGetDisplay(glfwGetX11Display());
+ static union { EGLDisplay (*fun)(EGLNativeDisplayType); void *ptr; } orig;
+ if (!orig.ptr) orig.ptr = dlsym(RTLD_NEXT, "eglGetDisplay");
+ return orig.fun(glfwGetX11Display());
}
EGLSurface
eglCreateWindowSurface(EGLDisplay display, EGLConfig config, NativeWindowType native_window, EGLint const *attrib_list)
{
- static EGLSurface (*orig_eglCreateWindowSurface)(EGLDisplay display, EGLConfig config, NativeWindowType native_window, EGLint const *attrib_list);
- if (!orig_eglCreateWindowSurface) orig_eglCreateWindowSurface = dlsym(RTLD_NEXT, "eglCreateWindowSurface");
+ static union { EGLSurface (*fun)(EGLDisplay, EGLConfig, NativeWindowType, EGLint const*); void *ptr; } orig;
+ if (!orig.ptr) orig.ptr = dlsym(RTLD_NEXT, "eglCreateWindowSurface");
struct ANativeWindow *win = (struct ANativeWindow*)native_window;
- return orig_eglCreateWindowSurface(display, config, glfwGetX11Window(win->glfw), attrib_list);
+ return orig.fun(display, config, glfwGetX11Window(win->glfw), attrib_list);
}