Re: [PATCH 1/3] merge-ort: copy a few small helper functions from merge-recursive.c
- From
Felipe Contreras <felipe.contreras@gmail.com>
- Date
- Dec 16, 2020, 21:25 UTC
- Message-ID
- <5fda7b2ee79df_8c35208e1@natae.notmuch>
- In-Reply-To
- <xmqqlfdx32ln.fsf@gitster.c.googlers.com>
Junio C Hamano wrote:
Show 20 quoted lines
> Elijah Newren <newren@gmail.com> writes:
>
> > I wonder if a slightly different codeflow may be easier to follow
> >>
> >> struct commit_list *result = NULL;
> >> while (list) {
> >> struct commit_list *next = list->next;
> >> list->next = result;
> >> result = list;
> >> list = next;
> >> }
> >> return result;
> >>
> >> if we were to try improving this for readability?
> >
> > Looks like Felipe also came up with the same version you did (modulo
> > the temporary variable name).
>
> Funny if it was sent as a response to the message that already had
> the same answer...It's two changes, actually: s/result/current/ and s/next/tmp/.
But yeah, it's interesting that I used Elijahs's version as a basis and arrived at virtually the same thing.
Cheers.
-- Felipe Contreras