Patchwork [1,of,2] reachableroots: narrow scope of minidx variable

login
register
mail settings
Submitter Yuya Nishihara
Date Aug. 27, 2015, 2:32 p.m.
Message ID <941c785d0bcc1891d4df.1440685921@mimosa>
Download mbox | patch
Permalink /patch/10295/
State Accepted
Headers show

Comments

Yuya Nishihara - Aug. 27, 2015, 2:32 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1439522528 -32400
#      Fri Aug 14 12:22:08 2015 +0900
# Node ID 941c785d0bcc1891d4df6ecc991d851d146131dd
# Parent  e7e7182564f60622bd98083e94af3da74d597eaa
reachableroots: narrow scope of minidx variable

minidx is never used if includepath is false, so let's define it where it
is used.

Patch

diff --git a/mercurial/parsers.c b/mercurial/parsers.c
--- a/mercurial/parsers.c
+++ b/mercurial/parsers.c
@@ -1127,7 +1127,6 @@  static PyObject *reachableroots2(indexOb
 	Py_ssize_t i;
 	Py_ssize_t l;
 	int r;
-	int minidx;
 	int parents[2];
 
 	/* Internal data structure:
@@ -1229,7 +1228,7 @@  static PyObject *reachableroots2(indexOb
 	/* Find all the nodes in between the roots we found and the heads
 	 * and add them to the reachable set */
 	if (includepath == 1) {
-		minidx = minroot;
+		int minidx = minroot;
 		if (minidx < 0)
 			minidx = 0;
 		for (i = minidx; i < len; i++) {