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

Edward O'Callaghan funfunctor at folklore1984.net
Mon Mar 27 02:54:03 UTC 2017



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?

Kindly,
Edward.

> 
> -Brian
>  
> 
> 
>         /* For GL_MAX_COMBINED_DIMENSIONS we need to get back 2 32-bit
>     integers,
>          * and at the same time we only need 2. So for that pname, we
>     call the
>     --
>     2.9.3
> 
>     _______________________________________________
>     mesa-dev mailing list
>     mesa-dev at lists.freedesktop.org <mailto:mesa-dev at lists.freedesktop.org>
>     https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>     <https://lists.freedesktop.org/mailman/listinfo/mesa-dev>
> 
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170327/8ba71fb0/attachment.sig>


More information about the mesa-dev mailing list