From 0890aa6f7fdbe33721b8ef2039608390c5aa886e Mon Sep 17 00:00:00 2001 From: Christian Gmeiner Date: Wed, 9 Nov 2016 15:50:05 +0100 Subject: [PATCH] loader: add loader_get_extensions_name(..) helper Changes since v1: - renamed function to loader_get_extensions_name - moved function into loader Signed-off-by: Christian Gmeiner V2: [Emil Velikov] - Use local define. Signed-off-by: Emil Velikov --- src/loader/loader.c | 19 +++++++++++++++++++ src/loader/loader.h | 2 ++ 2 files changed, 21 insertions(+) diff --git a/src/loader/loader.c b/src/loader/loader.c index fe90307765c..fd05f08e64f 100644 --- a/src/loader/loader.c +++ b/src/loader/loader.c @@ -396,3 +396,22 @@ loader_set_logger(void (*logger)(int level, const char *fmt, ...)) { log_ = logger; } + +/* XXX: Local definition to avoid pulling the heavyweight GL/gl.h and + * GL/internal/dri_interface.h + */ + +#ifndef __DRI_DRIVER_GET_EXTENSIONS +#define __DRI_DRIVER_GET_EXTENSIONS "__driDriverGetExtensions" +#endif + +char * +loader_get_extensions_name(const char *driver_name) +{ + char *name = NULL; + + if (asprintf(&name, "%s_%s", __DRI_DRIVER_GET_EXTENSIONS, driver_name) < 0) + return NULL; + + return name; +} diff --git a/src/loader/loader.h b/src/loader/loader.h index d404f5b67fc..84314a4fc04 100644 --- a/src/loader/loader.h +++ b/src/loader/loader.h @@ -65,6 +65,8 @@ loader_get_user_preferred_fd(int default_fd, int *different_device); void loader_set_logger(void (*logger)(int level, const char *fmt, ...)); +char * +loader_get_extensions_name(const char *driver_name); #ifdef __cplusplus } -- 2.30.2