[Mesa-dev] [PATCH 3/3] dri: fixup driver names if needed

Eric Engestrom eric.engestrom at imgtec.com
Fri Nov 4 11:59:26 UTC 2016


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?

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 :)

> +	}
> +
>  	return name;
>  }
>  
> -- 
> 2.7.4
> 


More information about the mesa-dev mailing list