]> git.ipfire.org Git - thirdparty/git.git/commit - revision.c
revision: replace "struct cmdline_pathspec" with argv_array
authorJeff King <peff@peff.net>
Wed, 20 Sep 2017 20:36:59 +0000 (16:36 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 21 Sep 2017 04:09:46 +0000 (13:09 +0900)
commit7fa3c2ad6d06428dcbd801ced55dffd22027cc96
tree87c6e882ddb3bafe97eace6ca64ee08acac818b3
parent9ddaf86b06a8078420f59aec8cab6daa93cf1a91
revision: replace "struct cmdline_pathspec" with argv_array

We assemble an array of strings in a custom struct,
NULL-terminate the result, and then pass it to
parse_pathspec().

But then we never free the array or the individual strings
(nor can we do the latter, as they are heap-allocated when
they come from stdin but not when they come from the
passed-in argv).

Let's swap this out for an argv_array. It does the same
thing with fewer lines of code, and it's safe to call
argv_array_clear() at the end to avoid a memory leak.

Reported-by: Martin Ă…gren <martin.agren@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
revision.c