git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Neil Horman <nhorman@tuxdriver.com>
Cc: Felipe Contreras <felipe.contreras@gmail.com>,
	git@vger.kernel.org, Christian Couder <chriscool@tuxfamily.org>,
	Jonathan Nieder <jrnieder@gmail.com>,
	Ramkumar Ramachandra <artagnon@gmail.com>
Subject: Re: [PATCH 1/2] sequencer: trivial fix
Date: Tue, 28 May 2013 10:04:21 -0700	[thread overview]
Message-ID: <7vobbv2fze.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: 20130528110014.GA1264@hmsreliant.think-freely.org

Neil Horman <nhorman@tuxdriver.com> writes:

> On Mon, May 27, 2013 at 11:52:18AM -0500, Felipe Contreras wrote:
>> We should free objects before leaving.
>> 
>> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
>> ---
>>  sequencer.c | 7 +++++--
>>  1 file changed, 5 insertions(+), 2 deletions(-)
>> 
>> diff --git a/sequencer.c b/sequencer.c
>> index ab6f8a7..7eeae2f 100644
>> --- a/sequencer.c
>> +++ b/sequencer.c
>> @@ -626,12 +626,15 @@ static int do_pick_commit(struct commit *commit, struct replay_opts *opts)
>>  		rerere(opts->allow_rerere_auto);
>>  	} else {
>>  		int allow = allow_empty(opts, commit);
>> -		if (allow < 0)
>> -			return allow;
>> +		if (allow < 0) {
>> +			res = allow;
>> +			goto leave;
>> +		}
>>  		if (!opts->no_commit)
>>  			res = run_git_commit(defmsg, opts, allow);
>>  	}
>>  
>> +leave:
>>  	free_message(&msg);
>>  	free(defmsg);
>>  
>> -- 
>> 1.8.3.rc3.312.g47657de
>> 
>> 
> Acked-by: Neil Horman <nhorman@tuxdriver.com>

This is better done without "goto" in general.

The other patch 2/2/ adds one more "we need to exit from the middle
of the flow" and makes it look handier to add an exit label here,
but it would be even better to express the logic of that patch as a
normal cascade of if/else if/..., which is small enough and we do
not need the "leave:" label.

It probably is better to fold this patch into the other one when it
is rerolled to correct the option name gotcha "on the tin".

Thanks.

  reply	other threads:[~2013-05-28 17:04 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-27 16:52 [PATCH 0/2] cherry-pick: a fix and a new option Felipe Contreras
2013-05-27 16:52 ` [PATCH 1/2] sequencer: trivial fix Felipe Contreras
2013-05-28 11:00   ` Neil Horman
2013-05-28 17:04     ` Junio C Hamano [this message]
2013-05-29  2:32       ` Felipe Contreras
2013-05-29  9:58         ` Joachim Schmitz
2013-05-29 10:51           ` Felipe Contreras
2013-05-29 11:13             ` Joachim Schmitz
2013-05-29 11:23               ` Felipe Contreras
2013-05-29 11:29                 ` Joachim Schmitz
2013-05-29 11:37                 ` Joachim Schmitz
2013-05-29 13:13         ` Neil Horman
2013-05-29 13:25   ` Duy Nguyen
2013-05-29 13:34     ` Felipe Contreras
2013-05-29 13:42       ` Duy Nguyen
2013-05-29 13:46         ` Felipe Contreras
2013-05-29 13:54           ` Duy Nguyen
2013-05-29 14:10             ` Felipe Contreras
2013-05-27 16:52 ` [PATCH 2/2] cherry-pick: add --skip-commits option Felipe Contreras
2013-05-28 10:29   ` Joachim Schmitz
2013-05-28 11:06   ` Neil Horman

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=7vobbv2fze.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=artagnon@gmail.com \
    --cc=chriscool@tuxfamily.org \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=nhorman@tuxdriver.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).