dri: make use of loader_get_extensions_name(..) helper
authorChristian Gmeiner <christian.gmeiner@gmail.com>
Wed, 9 Nov 2016 14:50:06 +0000 (15:50 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Tue, 15 Nov 2016 18:15:16 +0000 (18:15 +0000)
Changes since v1:
 - removed not needed includes
 - use the loader version of the helper

v2 [Emil Velikov]
 - Keep the includes - they are required.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
src/egl/drivers/dri2/egl_dri2.c
src/gbm/backends/dri/gbm_dri.c
src/glx/dri_common.c

index d9e2ad701b79586208acb8d9b875086d1a9ead01..f18e9fbd673a4dae8d7ef5845404f054fc7b3eb3 100644 (file)
@@ -56,6 +56,7 @@
 #endif
 
 #include "egl_dri2.h"
+#include "loader/loader.h"
 #include "util/u_atomic.h"
 
 /* The kernel header drm_fourcc.h defines the DRM formats below.  We duplicate
@@ -514,8 +515,8 @@ dri2_open_driver(_EGLDisplay *disp)
 
    _eglLog(_EGL_DEBUG, "DRI2: dlopen(%s)", path);
 
-   if (asprintf(&get_extensions_name, "%s_%s",
-                __DRI_DRIVER_GET_EXTENSIONS, dri2_dpy->driver_name) != -1) {
+   get_extensions_name = loader_get_extensions_name(dri2_dpy->driver_name);
+   if (get_extensions_name) {
       get_extensions = dlsym(dri2_dpy->driver, get_extensions_name);
       if (get_extensions) {
          extensions = get_extensions();
index 5cd7318d57b6604196812cb7e3c7ca6ba3c119a6..96a1f8755512d7247afb32248f925f170ff2a819 100644 (file)
@@ -363,8 +363,8 @@ dri_open_driver(struct gbm_dri_device *dri)
       return NULL;
    }
 
-   if (asprintf(&get_extensions_name, "%s_%s",
-                __DRI_DRIVER_GET_EXTENSIONS, dri->base.driver_name) != -1) {
+   get_extensions_name = loader_get_extensions_name(dri->base.driver_name);
+   if (get_extensions_name) {
       const __DRIextension **(*get_extensions)(void);
 
       get_extensions = dlsym(dri->driver, get_extensions_name);
index 6728d38fa0a104b716bb9aeea9860b163c65ba85..854733a5bea578f7bb2bd1633e06ec8d3faff310 100644 (file)
@@ -161,10 +161,9 @@ driGetDriverExtensions(void *handle, const char *driver_name)
 {
    const __DRIextension **extensions = NULL;
    const __DRIextension **(*get_extensions)(void);
-   char *get_extensions_name;
+   char *get_extensions_name = loader_get_extensions_name(driver_name);
 
-   if (asprintf(&get_extensions_name, "%s_%s",
-                __DRI_DRIVER_GET_EXTENSIONS, driver_name) != -1) {
+   if (get_extensions_name) {
       get_extensions = dlsym(handle, get_extensions_name);
       if (get_extensions) {
          free(get_extensions_name);