Message ID | 20191120095238.4349-2-rybak.a.v@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [RFC,v2,1/4] builtin/rebase.c: reuse loop variable | expand |
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";
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";
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". Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com> --- builtin/rebase.c | 4 ---- 1 file changed, 4 deletions(-)