summaryrefslogtreecommitdiff
path: root/builtin/push.c
diff options
context:
space:
mode:
authorJared Hance <jaredhance@gmail.com>2010-07-31 12:54:55 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-08-02 18:53:18 (GMT)
commit8a883b0260ba7f8d6e4c025ae3c32b454e80ade5 (patch)
tree2c0697d95f057cdb3903053eba8f1dd67876cc2d /builtin/push.c
parent61bf126ecb24977b883079942b71ff96174c19fb (diff)
downloadgit-8a883b0260ba7f8d6e4c025ae3c32b454e80ade5.zip
git-8a883b0260ba7f8d6e4c025ae3c32b454e80ade5.tar.gz
git-8a883b0260ba7f8d6e4c025ae3c32b454e80ade5.tar.bz2
builtin/push.c: remove useless temporary variable
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. While at it, use ALLOC_GROW() instead of xrealloc(). Signed-off-by: Jared Hance <jaredhance@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/push.c')
-rw-r--r--builtin/push.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/builtin/push.c b/builtin/push.c
index f4358b9..a2cc9fd 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -22,13 +22,13 @@ static int progress;
static const char **refspec;
static int refspec_nr;
+static int refspec_alloc;
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++;
+ ALLOC_GROW(refspec, refspec_nr, refspec_alloc);
+ refspec[refspec_nr-1] = ref;
}
static void set_refspecs(const char **refs, int nr)