Re: [PATCH v5 05/16] bisect--helper: make `terms` an explicit singleton
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 28, 2022, 06:53 UTC
- Message-ID
- <xmqqk06svoxp.fsf@gitster.g>
- In-Reply-To
- <92b3b116ef8f879192d9deb94d68b73e29d5dcd6.1661604264.git.gitgitgadget@gmail.com>
"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 6 quoted lines
> -struct bisect_terms {
> +static struct bisect_terms {
> char *term_good;
> char *term_bad;
> -};
> +} terms;On the surface, more global state may feel sad, but I do not think we want to run multiple bisection in one session anyway. Overall this may result in a simplicity win, hopefully.
The patch is noisy, but mostly from rewriting "terms->member" to "terms.member". I am not sure if that was worth the effort, though. You had a code that plumbed a parameter through the call graph, and instead of destroying that arrangement, you could have just replaced the reference at the beginning of the call chain to use the global state instead of an on-stack variable that the caller used to have.
I have no strong preference, but I do not think that it particularly contributes to "clarifying that we are using global state" to make direct accesses to the variable everywhere. I dunno.