Re: [PATCH] http: use internal argv_array of struct child_process

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 22, 2017 at 3:14 AM, René Scharfe <l.s.r@xxxxxx> wrote:
> Avoid a strangely magic array size (it's slightly too big) and explicit
> index numbers by building the command line for index-pack using the
> embedded argv_array of the child_process.  The resulting code is shorter
> and easier to extend.
>
> Signed-off-by: Rene Scharfe <l.s.r@xxxxxx>
> ---
> diff --git a/http.c b/http.c
> @@ -2041,13 +2040,10 @@ int finish_http_pack_request(struct http_pack_request *preq)
> -       ip_argv[0] = "index-pack";
> -       ip_argv[1] = "-o";
> -       ip_argv[2] = tmp_idx;
> -       ip_argv[3] = preq->tmpfile;
> -       ip_argv[4] = NULL;
> -
> -       ip.argv = ip_argv;
> +       argv_array_push(&ip.args, "index-pack");
> +       argv_array_push(&ip.args, "-o");
> +       argv_array_push(&ip.args, tmp_idx);
> +       argv_array_push(&ip.args, preq->tmpfile);

Not necessarily worth a re-roll, but using the "pushl" variant would
make it clear that "-o" and tmp_idx are related and would ensure that
they don't accidentally get split up if someone inserts a new "push"
in the sequence in the future.

    argv_array_push(&ip.args, "index-pack");
    argv_array_pushl(&ip.args, "-o", tmp_idx, NULL);
    argv_array_push(&ip.args, preq->tmpfile);




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux