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>
maint
Jared Hance 2010-07-31 08:54:55 -04:00 committed by Junio C Hamano
parent 61bf126ecb
commit 8a883b0260
1 changed files with 4 additions and 4 deletions

View File

@ -22,13 +22,13 @@ static int progress;


static const char **refspec; static const char **refspec;
static int refspec_nr; static int refspec_nr;
static int refspec_alloc;


static void add_refspec(const char *ref) static void add_refspec(const char *ref)
{ {
int nr = refspec_nr + 1; refspec_nr++;
refspec = xrealloc(refspec, nr * sizeof(char *)); ALLOC_GROW(refspec, refspec_nr, refspec_alloc);
refspec[nr-1] = ref; refspec[refspec_nr-1] = ref;
refspec_nr = nr;
} }


static void set_refspecs(const char **refs, int nr) static void set_refspecs(const char **refs, int nr)