[PATCH 1/2] Remove useless temporary integer in builtin/push.c
- From
Jared Hance <jaredhance@gmail.com>
- Date
- Jul 31, 2010, 12:54 UTC
- Message-ID
- <70ee84752cb7db08c65c608a12ed321dd2c26830.1280580026.git.jaredhance@gmail.com>
- In-Reply-To
- <cover.1280580026.git.jaredhance@gmail.com>
Creating a variable nr here to use throughout the function only to change refspec_nr to nr at the end, having not used refspec_nr the entire time, is rather pointless. Instead, simply increment refspec_nr.
Signed-off-by: Jared Hance <jaredhance@gmail.com> --- builtin/push.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/builtin/push.c b/builtin/push.c index f4358b9..79d8192 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -25,10 +25,9 @@ static int refspec_nr; static void add_refspec(const char *ref) { - int nr = refspec_nr + 1; - refspec = xrealloc(refspec, nr * sizeof(char *)); - refspec[nr-1] = ref; - refspec_nr = nr; + refspec_nr++; + refspec = xrealloc(refspec, refspec_nr * sizeof(char *)); + refspec[refspec_nr-1] = ref; } static void set_refspecs(const char **refs, int nr)
-- 1.7.2