widl: Initialize variables that are not necessarily filled in encode_type

Huw Davies huw at codeweavers.com
Wed Feb 22 03:35:26 CST 2017


On Mon, Feb 20, 2017 at 10:06:46PM +0100, André Hentschel wrote:
> Signed-off-by: André Hentschel <nerv at dawncrow.de>
> ---
> 
> This helps with reproducable builds
> 
>  tools/widl/write_msft.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/widl/write_msft.c b/tools/widl/write_msft.c
> index 137bb2d..39be30b 100644
> --- a/tools/widl/write_msft.c
> +++ b/tools/widl/write_msft.c
> @@ -2195,7 +2195,7 @@ static void add_union_typeinfo(msft_typelib_t *typelib, type_t *tunion)
>  static void add_typedef_typeinfo(msft_typelib_t *typelib, type_t *tdef)
>  {
>      msft_typeinfo_t *msft_typeinfo = NULL;
> -    int alignment, datatype1, datatype2, size, duplicate = 0;
> +    int alignment = 0, datatype1 = 0, datatype2 = 0, size = 0, duplicate = 0;

encode_type() initializes alignment, datatype1 and size in all cases, so these
are unnecessary.  The question then becomes where is the best place to
initialize datatype2 (a.k.a. decoded_size).  Since no caller to encode_type()
relies on the existing value being preserved, it makes sense to initialize
it in encode_type().  So just send the patch you originally sent to wine-devel.

Huw.



More information about the wine-devel mailing list