diff: remove parseopts member from struct diff_options
commit189e97bc4ba8d5f2ab4746d41204feed159fbe9a
authorRené Scharfe <l.s.r@web.de>
Thu, 1 Dec 2022 22:53:17 +0000 (1 23:53 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 1 Dec 2022 23:25:30 +0000 (2 08:25 +0900)
tree21ac76b1ea677686d215abcc3f17bcd58455ad92
parent6c6048fa7f1cf7b9ae79beb0f57fd03dd4021bb4
diff: remove parseopts member from struct diff_options

repo_diff_setup() builds the struct option array with git diff's command
line options and stores a pointer to it in the parseopts member of
struct diff_options.  The array is freed by diff_setup_done(), but not
by release_revisions().  Thus calling only repo_diff_setup() and
release_revisions() leaks that array.

We could free it in release_revisions() as well to plug that leak, but
there is a better way: Only build it when needed.  Absorb
prep_parse_options() into the last place that uses the parseopts member
of struct diff_options, add_diff_parseopts(), and get rid of said
member.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c
diff.h