git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Remove useless temporary integer in builtin/push.c
@ 2010-07-29 15:59 Jared Hance
  2010-07-29 22:21 ` Thomas Rast
  0 siblings, 1 reply; 6+ messages in thread
From: Jared Hance @ 2010-07-29 15:59 UTC (permalink / raw)
  To: git; +Cc: gitster

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-08-02 18:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-29 15:59 [PATCH] Remove useless temporary integer in builtin/push.c Jared Hance
2010-07-29 22:21 ` Thomas Rast
2010-07-31 12:54   ` [PATCH 0/2] Clean up add_refspec " Jared Hance
2010-07-31 12:54     ` [PATCH 1/2] Remove useless temporary integer " Jared Hance
2010-08-02 18:51       ` Junio C Hamano
2010-07-31 12:57     ` [PATCH 2/2] Use ALLOC_GROW " Jared Hance

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 NNTP newsgroup(s).