]> git.ipfire.org Git - thirdparty/git.git/commit - line-log.c
convert manual allocations to argv_array
authorJeff King <peff@peff.net>
Mon, 22 Feb 2016 22:44:21 +0000 (17:44 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 22 Feb 2016 22:50:32 +0000 (14:50 -0800)
commit850d2fec53ee188bab9e458f77906041ac7f1904
tree159000ee6af85ab7e33477c9e94ff42e4c942a7f
parentb992657ed0e2720e20302b0ac8c210dff55950b2
convert manual allocations to argv_array

There are many manual argv allocations that predate the
argv_array API. Switching to that API brings a few
advantages:

  1. We no longer have to manually compute the correct final
     array size (so it's one less thing we can screw up).

  2. In many cases we had to make a separate pass to count,
     then allocate, then fill in the array. Now we can do it
     in one pass, making the code shorter and easier to
     follow.

  3. argv_array handles memory ownership for us, making it
     more obvious when things should be free()d and and when
     not.

Most of these cases are pretty straightforward. In some, we
switch from "run_command_v" to "run_command" which lets us
directly use the argv_array embedded in "struct
child_process".

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/grep.c
builtin/receive-pack.c
builtin/remote-ext.c
daemon.c
git.c
line-log.c
remote-curl.c