[Mesa-dev] [PATCH v2] mesa/main: Fix memset in formatquery.c

Brian Paul brianp at vmware.com
Mon Mar 27 14:37:04 UTC 2017


On 03/26/2017 08:54 PM, Edward O'Callaghan wrote:
>
>
> On 03/27/2017 01:49 PM, Brian Paul wrote:
>> On Sun, Mar 26, 2017 at 5:51 PM, Edward O'Callaghan
>> <funfunctor at folklore1984.net <mailto:funfunctor at folklore1984.net>> wrote:
>>
>>      V.1:
>>      We memset number of elements without multiplication by the
>>      element size.
>>
>>      V.2:
>>      We explicitly set each member to -1 over using a confusing
>>      memset().
>>
>>      Signed-off-by: Edward O'Callaghan <funfunctor at folklore1984.net
>>      <mailto:funfunctor at folklore1984.net>>
>>      ---
>>       src/mesa/main/formatquery.c | 2 +-
>>       1 file changed, 1 insertion(+), 1 deletion(-)
>>
>>      diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
>>      index 598d34d..6aa57ec 100644
>>      --- a/src/mesa/main/formatquery.c
>>      +++ b/src/mesa/main/formatquery.c
>>      @@ -1564,7 +1564,7 @@ _mesa_GetInternalformati64v(GLenum target,
>>      GLenum internalformat,
>>           * no pname can return a negative value, we fill params32 with
>>      negative
>>           * values as reference values, that can be used to know what
>>      copy-back to
>>           * params */
>>      -   memset(params32, -1, 16);
>>      +   for (i = 0; i < realSize; i++) params32[i] = -1;
>>
>>
>> We'd generally write that for loop on two lines.
>>
>> for (i = 0; i < realSize; i++)
>>     params32[i] = -1;
>
> Sure thing Brian, I can fixup the style before commit can I get your Rb
> with that?

Reviewed-by: Brian Paul <brianp at vmware.com>




More information about the mesa-dev mailing list