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

Brian Paul brian.e.paul at gmail.com
Mon Mar 27 02:49:50 UTC 2017


On Sun, Mar 26, 2017 at 5:51 PM, Edward O'Callaghan <
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>
> ---
>  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;

-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
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170326/e003f3e1/attachment.html>


More information about the mesa-dev mailing list