All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Derrick Stolee <derrickstolee@github.com>
Cc: Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>,
	git@vger.kernel.org, Elijah Newren <newren@gmail.com>
Subject: Re: [PATCH] merge-ort: fix calling merge_finalize() with no intermediate merge
Date: Thu, 20 Apr 2023 10:10:21 -0700	[thread overview]
Message-ID: <xmqqa5z21nuq.fsf@gitster.g> (raw)
In-Reply-To: <d5c93b5b-32b9-ec50-1661-06f73fa37f5f@github.com> (Derrick Stolee's message of "Thu, 20 Apr 2023 09:10:47 -0400")

Derrick Stolee <derrickstolee@github.com> writes:

> On 4/20/2023 3:14 AM, Elijah Newren via GitGitGadget wrote:
>> From: Elijah Newren <newren@gmail.com>
>
>> While at it, ensure the FREE_AND_NULL() in the function does something
>> useful with the nulling aspect, namely sets result->priv to NULL rather
>> than a mere temporary.
>
> Good call. It also makes the code look better.

And more correct, if the NULLness of result->priv matters.

> Perhaps this would be better as
>
> 	if (result->priv) {
> 		clear_or_reinit_internal_opts(result->priv, 0);
> 		FREE_AND_NULL(result->priv);
> 	}
>
> to avoid an accidental addition of code to the end of this
> method that doesn't depend on result->priv?

It does sound like a good idea.

Thanks.

  reply	other threads:[~2023-04-20 17:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-20  7:14 [PATCH] merge-ort: fix calling merge_finalize() with no intermediate merge Elijah Newren via GitGitGadget
2023-04-20 13:10 ` Derrick Stolee
2023-04-20 17:10   ` Junio C Hamano [this message]
2023-04-22  2:04   ` Elijah Newren
2023-04-20 16:11 ` Junio C Hamano
2023-04-22 20:22 ` [PATCH v2] " Elijah Newren via GitGitGadget
2023-04-24 15:17   ` Derrick Stolee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqa5z21nuq.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=derrickstolee@github.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=newren@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.