[Mesa-dev] [PATCH] meta: init var to silence uninitialized variable warning

Matt Turner mattst88 at gmail.com
Sat Dec 20 09:51:17 PST 2014


On Sat, Dec 20, 2014 at 4:34 AM, Brian Paul <brianp at vmware.com> wrote:
> ---
>  src/mesa/drivers/common/meta.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
> index 87532c1..f479b1c 100644
> --- a/src/mesa/drivers/common/meta.c
> +++ b/src/mesa/drivers/common/meta.c
> @@ -3177,7 +3177,7 @@ _mesa_meta_GetTexImage(struct gl_context *ctx,
>  {
>     if (_mesa_is_format_compressed(texImage->TexFormat)) {
>        GLuint slice;
> -      bool result;
> +      bool result = true;

This looks like a case where I'd put an

    assume(texImage->Depth > 0)

immediately above the for loop.

>        for (slice = 0; slice < texImage->Depth; slice++) {
>           void *dst;

That way, the compiler gets the information it needs, and we don't add
any extra .data.


More information about the mesa-dev mailing list