[Mesa-dev] [PATCH 3/3] dri: fixup driver names if needed
Christian Gmeiner
christian.gmeiner at gmail.com
Mon Nov 7 10:48:43 UTC 2016
2016-11-04 12:59 GMT+01:00 Eric Engestrom <eric.engestrom at imgtec.com>:
> On Thursday, 2016-11-03 15:25:22 +0100, Christian Gmeiner wrote:
>> 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.
>>
>> Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
>> ---
>> include/GL/internal/dri_interface.h | 7 +++++++
>> 1 file changed, 7 insertions(+)
>>
>> diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
>> index 36ba65e..4ec3211 100644
>> --- a/include/GL/internal/dri_interface.h
>> +++ b/include/GL/internal/dri_interface.h
>> @@ -42,6 +42,7 @@
>>
>> #include <stdio.h>
>> #include <stdlib.h>
>> +#include <string.h>
>> #include <dlfcn.h>
>> #ifdef HAVE_LIBDRM
>> #include <drm.h>
>> @@ -617,6 +618,12 @@ dri_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] = '_';
>
> Why not replace all non-alnum chars?
>
I am not sure with what char I should replace them.
> Either way, the series is:
> Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>
>
> Also, for the asprintf->malloc change, I think that should be a separate
> patch, as the code being deduplicated in the first patch was already
> using asprintf :)
>
good point - v2 will hit ml soon.
>> + }
>> +
>> return name;
>> }
>>
>> --
>> 2.7.4
>>
greets
--
Christian Gmeiner, MSc
https://soundcloud.com/christian-gmeiner
More information about the mesa-dev
mailing list