[Mesa-dev] [PATCH 1/2] tgsi: avoid returning pointer to local var

Matt Turner mattst88 at gmail.com
Sat Feb 21 13:37:51 PST 2015


On Sat, Feb 21, 2015 at 10:54 AM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> Spotted by Coverity.
>
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
>  src/gallium/auxiliary/tgsi/tgsi_exec.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c
> index a8fc008..1c08e35 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
> +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
> @@ -1506,6 +1506,8 @@ fetch_source(const struct tgsi_exec_machine *mach,
>     }
>  }
>
> +static union tgsi_exec_channel null;
> +

You don't need to move the definition. Just mark the existing one static.

>  static union tgsi_exec_channel *
>  store_dest_dstret(struct tgsi_exec_machine *mach,
>                   const union tgsi_exec_channel *chan,
> @@ -1515,7 +1517,6 @@ store_dest_dstret(struct tgsi_exec_machine *mach,
>                   enum tgsi_exec_datatype dst_datatype)
>  {
>     uint i;
> -   union tgsi_exec_channel null;
>     union tgsi_exec_channel *dst;
>     union tgsi_exec_channel index2D;
>     uint execmask = mach->ExecMask;
> --
> 2.0.5
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list