loader: fixup driver names if needed
authorChristian Gmeiner <christian.gmeiner@gmail.com>
Wed, 9 Nov 2016 14:50:07 +0000 (15:50 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Tue, 15 Nov 2016 15:59:23 +0000 (15:59 +0000)
This makes it possible to 'use' the imx-drm driver. Remeber that it
is not possible to have sysmbol names in C/C++ with a '-' in it.

Changes since v1:
 - move the fix to loader.c

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> (v1)
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
src/loader/loader.c

index fd05f08e64fa685e29cd4c8b13bd93009c7fc1e1..449ff54d1377d1ac5432000d7a37bee1331e67cc 100644 (file)
@@ -413,5 +413,11 @@ loader_get_extensions_name(const char *driver_name)
    if (asprintf(&name, "%s_%s", __DRI_DRIVER_GET_EXTENSIONS, driver_name) < 0)
       return NULL;
 
+   const size_t len = strlen(name);
+   for (size_t i = 0; i < len; i++) {
+          if (name[i] == '-')
+                  name[i] = '_';
+   }
+
    return name;
 }