[Mesa-dev] [PATCH 1/3] dri: add dri_get_extensions_name(..) helper
Emil Velikov
emil.l.velikov at gmail.com
Thu Nov 3 19:07:24 UTC 2016
On 3 November 2016 at 17:53, Christian Gmeiner
<christian.gmeiner at gmail.com> wrote:
> Hi Emil,
>
> 2016-11-03 17:02 GMT+01:00 Emil Velikov <emil.l.velikov at gmail.com>:
>> On 3 November 2016 at 14:25, Christian Gmeiner
>> <christian.gmeiner at gmail.com> wrote:
>>> Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
>>> ---
>>> include/GL/internal/dri_interface.h | 14 ++++++++++++++
>>> 1 file changed, 14 insertions(+)
>>>
>>> diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
>>> index d0b1bc6..36ba65e 100644
>>> --- a/include/GL/internal/dri_interface.h
>>> +++ b/include/GL/internal/dri_interface.h
>>> @@ -40,6 +40,9 @@
>>> #ifndef DRI_INTERFACE_H
>>> #define DRI_INTERFACE_H
>>>
>>> +#include <stdio.h>
>>> +#include <stdlib.h>
>>> +#include <dlfcn.h>
>>> #ifdef HAVE_LIBDRM
>>> #include <drm.h>
>>> #else
>>> @@ -606,6 +609,17 @@ struct __DRIuseInvalidateExtensionRec {
>>> */
>>> #define __DRI_DRIVER_GET_EXTENSIONS "__driDriverGetExtensions"
>>>
>>> +static inline char *
>>> +dri_get_extensions_name(const char *driver_name)
>>> +{
>>> + char *name = NULL;
>>> +
>>> + if (asprintf(&name, "%s_%s", __DRI_DRIVER_GET_EXTENSIONS, driver_name) < 0)
>>> + return NULL;
>>> +
>> asprintf is a GNU extension and is missing on MSVC at least. I'm not
>> sure if the includes are ok/needed.
>>
>
> I can rewrite it to use malloc() and snprintf() directly and MSVC
> should be happy to.
>
>> Please move that anywhere in src/loader/ - be that new or existing file.
>>
>
> I can try to put the function directly into loader.[hc] and could rename it to
> loader_get_extensions_name(..).
>
Please do with the loader option.
Thanks
Emil
P.S. Related task for anyone bored: Refactor/move
driOpenDriver/driGetDriverExtensions/dri_bind_extensions and alike to
the loader.
More information about the mesa-dev
mailing list