diff mercurial/cext/revlog.c @ 40878:18a8def6e1b5

revlog: rename indexType to HgRevlogIndex_Type as it's a global symbol It follows the CPython naming convention, but uses Hg instead of Py.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 02 Dec 2018 21:41:24 +0900
parents aa76be85029b
children b12700dd261f
line wrap: on
line diff
--- a/mercurial/cext/revlog.c	Sun Dec 02 21:37:42 2018 +0900
+++ b/mercurial/cext/revlog.c	Sun Dec 02 21:41:24 2018 +0900
@@ -1516,7 +1516,8 @@
 {
 	PyObject *index;
 	unsigned capacity;
-	if (!PyArg_ParseTuple(args, "O!I", &indexType, &index, &capacity))
+	if (!PyArg_ParseTuple(args, "O!I", &HgRevlogIndex_Type, &index,
+	                      &capacity))
 		return -1;
 	Py_INCREF(index);
 	return nt_init(&self->nt, (indexObject *)index, capacity);
@@ -2581,7 +2582,7 @@
     {NULL} /* Sentinel */
 };
 
-PyTypeObject indexType = {
+PyTypeObject HgRevlogIndex_Type = {
     PyVarObject_HEAD_INIT(NULL, 0) /* header */
     "parsers.index",               /* tp_name */
     sizeof(indexObject),           /* tp_basicsize */
@@ -2637,7 +2638,7 @@
 	indexObject *idx;
 	int ret;
 
-	idx = PyObject_New(indexObject, &indexType);
+	idx = PyObject_New(indexObject, &HgRevlogIndex_Type);
 	if (idx == NULL)
 		goto bail;
 
@@ -2714,9 +2715,9 @@
 	Py_ssize_t i;
 
 	indexObject *index;
-	if (!PyArg_ParseTuple(args, "O!O!lO!", &indexType, &index, &PyList_Type,
-	                      &initrevsarg, &stoprev, &PyBool_Type,
-	                      &inclusivearg))
+	if (!PyArg_ParseTuple(args, "O!O!lO!", &HgRevlogIndex_Type, &index,
+	                      &PyList_Type, &initrevsarg, &stoprev,
+	                      &PyBool_Type, &inclusivearg))
 		return -1;
 
 	Py_INCREF(index);
@@ -2843,11 +2844,11 @@
 
 void revlog_module_init(PyObject *mod)
 {
-	indexType.tp_new = PyType_GenericNew;
-	if (PyType_Ready(&indexType) < 0)
+	HgRevlogIndex_Type.tp_new = PyType_GenericNew;
+	if (PyType_Ready(&HgRevlogIndex_Type) < 0)
 		return;
-	Py_INCREF(&indexType);
-	PyModule_AddObject(mod, "index", (PyObject *)&indexType);
+	Py_INCREF(&HgRevlogIndex_Type);
+	PyModule_AddObject(mod, "index", (PyObject *)&HgRevlogIndex_Type);
 
 	nodetreeType.tp_new = PyType_GenericNew;
 	if (PyType_Ready(&nodetreeType) < 0)