On Fri, Oct 2, 2015 at 2:51 AM, Iago Toral <ito...@igalia.com> wrote:
> On Thu, 2015-10-01 at 20:22 -0400, Ilia Mirkin wrote:
>> Signed-off-by: Ilia Mirkin <imir...@alum.mit.edu>
>> ---
>>  src/glsl/link_uniforms.cpp | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
>> index 47d49c8..740b0a4 100644
>> --- a/src/glsl/link_uniforms.cpp
>> +++ b/src/glsl/link_uniforms.cpp
>> @@ -1131,15 +1131,15 @@ link_assign_uniform_locations(struct 
>> gl_shader_program *prog,
>>     const unsigned num_data_slots = uniform_size.num_values;
>>     const unsigned hidden_uniforms = uniform_size.num_hidden_uniforms;
>>
>> +   /* assign hidden uniforms a slot id */
>> +   hiddenUniforms->iterate(assign_hidden_uniform_slot_id, &uniform_size);
>> +   delete hiddenUniforms;
>> +
>>     /* On the outside chance that there were no uniforms, bail out.
>>      */
>>     if (num_uniforms == 0)
>>        return;
>>
>> -   /* assign hidden uniforms a slot id */
>> -   hiddenUniforms->iterate(assign_hidden_uniform_slot_id, &uniform_size);
>> -   delete hiddenUniforms;
>> -
>
> I suppose there is no much gain in simply adding the delete statement
> right before the return...

That was my feeling as well -- the simplicity of having a single
delete seems to outweigh the modest overhead of iterating over an
empty hashtable.

Ideally we'd just use a scoped_ptr (RAII object that deletes ptr on
delete), but it's been too long for me to remember what is in what
version of what standard and I didn't want to get into that game.

>
> Reviewed-by: Iago Toral Quiroga <ito...@igalia.com>
>
>
>>     struct gl_uniform_storage *uniforms =
>>        rzalloc_array(prog, struct gl_uniform_storage, num_uniforms);
>>     union gl_constant_value *data =
>
>
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to