[Mesa-dev] [PATCH 6/9] gallivm: Remove lp_get_module_id.

Emil Velikov emil.l.velikov at gmail.com
Mon Apr 18 13:42:37 UTC 2016


On 18 April 2016 at 13:51, Jose Fonseca <jfonseca at vmware.com> wrote:
> On 18/04/16 13:30, Emil Velikov wrote:
>>
>> On 18 April 2016 at 10:14, Jose Fonseca <jfonseca at vmware.com> wrote:
>>
>>> @@ -306,6 +309,15 @@ init_gallivm_state(struct gallivm_state *gallivm,
>>> const char *name,
>>>      if (!gallivm->context)
>>>         goto fail;
>>>
>>> +   gallivm->module_name = NULL;
>>> +   if (name) {
>>> +      size_t size = strlen(name) + 1;
>>> +      gallivm->module_name = MALLOC(size);
>>> +      if (gallivm->module_name) {
>>> +         memcpy(gallivm->module_name, name, size);
>>
>> Since we already use stdup in gallium/aux one could do the same here.
>
>
> We shouldn't be using strdup in gallium/auxiliary.  The ability of embedded
> gallium and keep track of its memory allocations it's important.
>
> There's only one instance where inappropriate use of strdup crept in gallium
> (u_debug_symbol.c). But that's should be taken as a bug (not as precedent to
> imitate).
>
I see. Thanks for clarifying.

>
> In fact, nobody that cares for Vulkan should be using strdup outside of GL
> specific components at all -- see
> https://www.khronos.org/registry/vulkan/specs/1.0/xhtml/vkspec.html#memory-host
> --, use malloc/free/strdup/etc should be eliminated all together.  but I'll
> let others to worry about that.
>
Nice one ;-)

-Emil


More information about the mesa-dev mailing list