Re: [PATCH v2 12/27] revisions API users: use release_revisions() in builtin/log.c
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 25, 2022, 01:03 UTC
- Message-ID
- <xmqq5yo2etcq.fsf@gitster.g>
- In-Reply-To
- <patch-v2-12.27-74818bc372f-20220323T203149Z-avarab@gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 7 quoted lines
> In preparation for having the "log" family of functions make wider use > of release_revisions() let's have them call it just before > exiting. This changes the "log", "whatchanged", "show", > "format-patch", etc. commands, all of which live in this file. > > The release_revisions() API still only frees the "pending" member, but > will learn to more members of "struct rev_info" in subsequent commits.
Learn to do what to more members?
> In the case of "format-patch" revert the addition of UNLEAK() in > dee839a2633 (format-patch: mark rev_info with UNLEAK, 2021-12-16), and > which will cause several tests that previously passed under > "TEST_PASSES_SANITIZE_LEAK=true" to start failing.
", and which" -> ", which".
Show 13 quoted lines
> diff --git a/builtin/log.c b/builtin/log.c
> index 6f9928fabfe..c40ebe1c3f4 100644
> --- a/builtin/log.c
> +++ b/builtin/log.c
> @@ -295,6 +295,12 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
> cmd_log_init_finish(argc, argv, prefix, rev, opt);
> }
>
> +static int cmd_log_deinit(int ret, struct rev_info *rev)
> +{
> + release_revisions(rev);
> + return ret;
> +}Ugly but cute.
Show 8 quoted lines
> @@ -732,8 +738,7 @@ int cmd_show(int argc, const char **argv, const char *prefix)
> ret = error(_("unknown type: %d"), o->type);
> }
> }
> - free(objects);
> - return ret;
> + return cmd_log_deinit(ret, &rev);
> }This probably makes things worse tentatively for OBJ_COMMIT case, where we reuse the rev structure to "(un)walk" the given commit after clearing rev.pending, but hopefully you'll fix it up in a later step or two?