revlog: rename indexType to HgRevlogIndex_Type as it's a global symbol
authorYuya Nishihara <yuya@tcha.org>
Sun, 02 Dec 2018 21:41:24 +0900
changeset 53625 18a8def6e1b58a642e83f7a47ecaabd6f14d4a33
parent 53624 aa76be85029bddab0db79f959527bde8255198c5
child 53626 b12700dd261f03071d7536c141d965a311615632
push id1079
push usergszorc@mozilla.com
push dateMon, 10 Dec 2018 19:44:59 +0000
revlog: rename indexType to HgRevlogIndex_Type as it's a global symbol It follows the CPython naming convention, but uses Hg instead of Py.
mercurial/cext/revlog.c
mercurial/cext/revlog.h
--- a/mercurial/cext/revlog.c
+++ b/mercurial/cext/revlog.c
@@ -1511,17 +1511,18 @@ static int nt_init(nodetree *self, index
 	self->length = 1;
 	return 0;
 }
 
 static int ntobj_init(nodetreeObject *self, PyObject *args)
 {
 	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);
 }
 
 static int nt_partialmatch(nodetree *self, const char *node, Py_ssize_t nodelen)
 {
 	return nt_find(self, node, nodelen, 1);
@@ -2576,17 +2577,17 @@ static PyMethodDef index_methods[] = {
     {NULL} /* Sentinel */
 };
 
 static PyGetSetDef index_getset[] = {
     {"nodemap", (getter)index_nodemap, NULL, "nodemap", NULL},
     {NULL} /* Sentinel */
 };
 
-PyTypeObject indexType = {
+PyTypeObject HgRevlogIndex_Type = {
     PyVarObject_HEAD_INIT(NULL, 0) /* header */
     "parsers.index",               /* tp_name */
     sizeof(indexObject),           /* tp_basicsize */
     0,                             /* tp_itemsize */
     (destructor)index_dealloc,     /* tp_dealloc */
     0,                             /* tp_print */
     0,                             /* tp_getattr */
     0,                             /* tp_setattr */
@@ -2632,17 +2633,17 @@ PyTypeObject indexType = {
  * added complications are for backwards compatibility
  */
 PyObject *parse_index2(PyObject *self, PyObject *args)
 {
 	PyObject *tuple = NULL, *cache = NULL;
 	indexObject *idx;
 	int ret;
 
-	idx = PyObject_New(indexObject, &indexType);
+	idx = PyObject_New(indexObject, &HgRevlogIndex_Type);
 	if (idx == NULL)
 		goto bail;
 
 	ret = index_init(idx, args);
 	if (ret == -1)
 		goto bail;
 
 	if (idx->inlined) {
@@ -2709,19 +2710,19 @@ static int rustla_init(rustlazyancestors
 	PyObject *initrevsarg = NULL;
 	PyObject *inclusivearg = NULL;
 	long stoprev = 0;
 	long *initrevs = NULL;
 	int inclusive = 0;
 	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);
 	self->index = index;
 
 	if (inclusivearg == Py_True)
 		inclusive = 1;
 
@@ -2838,21 +2839,21 @@ static PyTypeObject rustlazyancestorsTyp
     0,                                              /* tp_dictoffset */
     (initproc)rustla_init,                          /* tp_init */
     0,                                              /* tp_alloc */
 };
 #endif /* WITH_RUST */
 
 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)
 		return;
 	Py_INCREF(&nodetreeType);
 	PyModule_AddObject(mod, "nodetree", (PyObject *)&nodetreeType);
 
 	if (!nullentry) {
--- a/mercurial/cext/revlog.h
+++ b/mercurial/cext/revlog.h
@@ -5,11 +5,11 @@
  the GNU General Public License, incorporated herein by reference.
 */
 
 #ifndef _HG_REVLOG_H_
 #define _HG_REVLOG_H_
 
 #include <Python.h>
 
-extern PyTypeObject indexType;
+extern PyTypeObject HgRevlogIndex_Type;
 
 #endif /* _HG_REVLOG_H_ */