git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Andrei Rybak <rybak.a.v@gmail.com>
Cc: git@vger.kernel.org, Johannes.Schindelin@gmx.de,
	phillip.wood@dunelm.org.uk, predatoramigo@gmail.com
Subject: Re: [RFC PATCH v2 1/4] builtin/rebase.c: reuse loop variable
Date: Thu, 21 Nov 2019 10:30:16 +0900	[thread overview]
Message-ID: <xmqqmucq9ftj.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20191120095238.4349-2-rybak.a.v@gmail.com> (Andrei Rybak's message of "Wed, 20 Nov 2019 10:52:35 +0100")

Andrei Rybak <rybak.a.v@gmail.com> writes:

> Variable "int i" is already defined at the top of the function
> cmd_rebase, so reuse it instead of declaring other variables, which mask
> the outer "i".

The log message must also mention the other reason why this
simplification is correct, namely, that outer "i" is dead at the
point in the code that is touched by this patch and the value is
never used in the later parts of the code (I just followed the
codepath and made sure that is the case---iow, I think this patch
is correct).

Thanks.

>
> Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
> ---
>  builtin/rebase.c | 4 ----
>  1 file changed, 4 deletions(-)
>
> diff --git a/builtin/rebase.c b/builtin/rebase.c
> index 4a20582e72..793cac1386 100644
> --- a/builtin/rebase.c
> +++ b/builtin/rebase.c
> @@ -1747,8 +1747,6 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
>  	}
>  
>  	if (exec.nr) {
> -		int i;
> -
>  		imply_interactive(&options, "--exec");
>  
>  		strbuf_reset(&buf);
> @@ -1769,8 +1767,6 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
>  	}
>  
>  	if (strategy_options.nr) {
> -		int i;
> -
>  		if (!options.strategy)
>  			options.strategy = "recursive";

  reply	other threads:[~2019-11-21  1:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-14 16:35 [PATCH 0/3] rebase --edit-todo --exec Andrei Rybak
2019-11-14 16:35 ` [PATCH 1/3] rebase: prepare cmd before choosing action Andrei Rybak
2019-11-15  5:49   ` Junio C Hamano
2019-11-14 16:35 ` [PATCH 2/3] rebase: extract add_exec() Andrei Rybak
2019-11-14 16:35 ` [PATCH 3/3] rebase -i: allow --edit-todo with --exec Andrei Rybak
2019-11-20  9:52 ` [RFC PATCH v2 0/4] rebase --edit-todo --exec Andrei Rybak
2019-11-20  9:52 ` [RFC PATCH v2 1/4] builtin/rebase.c: reuse loop variable Andrei Rybak
2019-11-21  1:30   ` Junio C Hamano [this message]
2019-11-20  9:52 ` [RFC PATCH v2 2/4] rebase: prepare cmd before choosing action Andrei Rybak
2019-11-21  2:00   ` Junio C Hamano
2019-11-22 19:08     ` Andrei Rybak
2019-11-20  9:52 ` [RFC PATCH v2 3/4] rebase: extract add_exec() Andrei Rybak
2019-11-20  9:52 ` [RFC PATCH v2 4/4] rebase -i: allow --edit-todo with --exec Andrei Rybak

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=xmqqmucq9ftj.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=predatoramigo@gmail.com \
    --cc=rybak.a.v@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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).