[PATCH 2 of 7] reachableroots: give anonymous name to short-lived "numheads" variable

Yuya Nishihara yuya at tcha.org
Tue Aug 18 09:42:54 CDT 2015


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1439630998 -32400
#      Sat Aug 15 18:29:58 2015 +0900
# Node ID 2c9e3a9f0ae4b40604269a5f24fb51fb669fca63
# Parent  ec875f53f7bdd78b215d1a312e3b958545b6368b
reachableroots: give anonymous name to short-lived "numheads" variable

I'll reuse it for the length of the roots list.

diff --git a/mercurial/parsers.c b/mercurial/parsers.c
--- a/mercurial/parsers.c
+++ b/mercurial/parsers.c
@@ -1114,7 +1114,6 @@ static PyObject *reachableroots(indexObj
 	int includepath = 0;
 	/* heads is a list */
 	PyObject *heads = NULL;
-	Py_ssize_t numheads;
 	/* roots is a set */
 	PyObject *roots = NULL;
 	PyObject *reachable = NULL;
@@ -1124,6 +1123,7 @@ static PyObject *reachableroots(indexObj
 	long revnum;
 	Py_ssize_t k;
 	Py_ssize_t i;
+	Py_ssize_t l;
 	int r;
 	int minidx;
 	int parents[2];
@@ -1164,8 +1164,8 @@ static PyObject *reachableroots(indexObj
 	}
 
 	/* Populate tovisit with all the heads */
-	numheads = PyList_GET_SIZE(heads);
-	for (i = 0; i < numheads; i++) {
+	l = PyList_GET_SIZE(heads);
+	for (i = 0; i < l; i++) {
 		revnum = PyInt_AsLong(PyList_GET_ITEM(heads, i));
 		if (revnum == -1 && PyErr_Occurred())
 			goto bail;


More information about the Mercurial-devel mailing list