From: Christian Gmeiner Date: Thu, 3 Nov 2016 14:25:21 +0000 (+0100) Subject: dri: make use of dri_get_extensions_name(..) helper X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1a21d21580965eff751414d140b3c176eeee2eb3;p=mesa.git dri: make use of dri_get_extensions_name(..) helper Signed-off-by: Christian Gmeiner Reviewed-by: Emil Velikov --- diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index d9e2ad701b7..593dd012330 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -514,8 +514,9 @@ 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 = dri_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(); diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c index 5cd7318d57b..4cb7f2775d9 100644 --- a/src/gbm/backends/dri/gbm_dri.c +++ b/src/gbm/backends/dri/gbm_dri.c @@ -363,8 +363,9 @@ 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 = dri_get_extensions_name(dri->base.driver_name); + + if (get_extensions_name) { const __DRIextension **(*get_extensions)(void); get_extensions = dlsym(dri->driver, get_extensions_name); diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c index 6728d38fa0a..67cf3c86fa8 100644 --- a/src/glx/dri_common.c +++ b/src/glx/dri_common.c @@ -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 = dri_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);