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

login
register
mail settings
Submitter Yuya Nishihara
Date Aug. 18, 2015, 2:42 p.m.
Message ID <2c9e3a9f0ae4b4060426.1439908974@mimosa>
Download mbox | patch
Permalink /patch/10224/
State Accepted
Delegated to: Augie Fackler
Headers show

Comments

Yuya Nishihara - Aug. 18, 2015, 2:42 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@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.

Patch

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;