Web lists-archives.com

Re: [PATCH 3/3] It's C not C++ so variable length array should not be used [-Werror=vla] :,).




On Fri, Feb 1, 2019 at 3:36 AM Shahzad Lone <shahzadlone@xxxxxxxxx> wrote:
> diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
> @@ -197,9 +197,8 @@ static unsigned long write_large_blob_data(struct git_istream *st, struct hashfi
>                                            const struct object_id *oid)
>  {
>         git_zstream stream;
> -       const unsigned bufsize = 16384;
> -       unsigned char ibuf[bufsize];
> -       unsigned char obuf[bufsize];
> +       unsigned char ibuf[16384];
> +       unsigned char obuf[16384];

Reiterating my comment on patch 2/3, this code was fine until your
patch 1/3 changed it declare a variable length array. Rather than
creating a new patch to fix an earlier mistake in the same patch
series, use "git rebase -i" to adjust patch 1/3 to not introduce the
problem in the first place and drop this patch, and then (re-)submit
the patch series.

Thanks.