loader: add loader_get_extensions_name(..) helper
authorChristian Gmeiner <christian.gmeiner@gmail.com>
Wed, 9 Nov 2016 14:50:05 +0000 (15:50 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Tue, 15 Nov 2016 15:55:33 +0000 (15:55 +0000)
Changes since v1:
 - renamed function to loader_get_extensions_name
 - moved function into loader

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
V2: [Emil Velikov]
 - Use local define.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
src/loader/loader.c
src/loader/loader.h

index fe90307765c9b3ed712ab61ee4f213b512310aec..fd05f08e64fa685e29cd4c8b13bd93009c7fc1e1 100644 (file)
@@ -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;
+}
index d404f5b67fcb2cbb30f35dc16ea130d710e3d894..84314a4fc045aa193ae6ce7a6697637d8764f0e9 100644 (file)
@@ -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
 }