@@ -43,7 +43,7 @@ extern PyTypeObject TreeIterType;
4343extern PyTypeObject IndexType ;
4444
4545#if PY_MAJOR_VERSION >= 3
46- #define Py_TPFLAGS_CHECKTYPES 0 // removed in Py3, needed in Py2
46+ #define Py_TPFLAGS_CHECKTYPES 0 /* removed in Py3, needed in Py2 */
4747#endif
4848
4949
@@ -184,6 +184,7 @@ treeentry_to_subtree(TreeEntry* self)
184184{
185185 Repository * py_repo ;
186186 git_tree * subtree = NULL ;
187+ int err ;
187188
188189 if (git_tree_entry_type (self -> entry ) != GIT_OBJ_TREE ) {
189190 PyErr_SetString (PyExc_TypeError , "Only for trees" );
@@ -196,7 +197,7 @@ treeentry_to_subtree(TreeEntry* self)
196197 }
197198
198199 py_repo = self -> repo ;
199- int err = git_tree_lookup (& subtree , py_repo -> repo , git_tree_entry_id (self -> entry ));
200+ err = git_tree_lookup (& subtree , py_repo -> repo , git_tree_entry_id (self -> entry ));
200201 if (err < 0 ) {
201202 Error_set (err );
202203 return NULL ;
@@ -210,14 +211,15 @@ treeentry_to_object(TreeEntry* self)
210211{
211212 Repository * py_repo ;
212213 git_object * obj = NULL ;
214+ int err ;
213215
214216 if (self -> repo == NULL ) {
215217 PyErr_SetString (PyExc_ValueError , "No repository associated with this TreeEntry" );
216218 return NULL ;
217219 }
218220 py_repo = self -> repo ;
219221
220- int err = git_tree_entry_to_object (& obj , py_repo -> repo , self -> entry );
222+ err = git_tree_entry_to_object (& obj , py_repo -> repo , self -> entry );
221223 if (err < 0 ) {
222224 Error_set (err );
223225 return NULL ;
@@ -230,8 +232,9 @@ PyDoc_STRVAR(TreeEntry_obj__doc__, "Object (subtree/blob)");
230232PyObject *
231233TreeEntry_obj__get__ (TreeEntry * self )
232234{
235+ git_tree * subtree ;
233236 if (git_tree_entry_type (self -> entry ) == GIT_OBJ_TREE ) {
234- git_tree * subtree = treeentry_to_subtree (self );
237+ subtree = treeentry_to_subtree (self );
235238 if (subtree == NULL )
236239 return NULL ;
237240
@@ -339,8 +342,9 @@ PyMappingMethods TreeEntry_as_mapping = {
339342 0 , /* mp_ass_subscript */
340343};
341344
342- // Py2/3 compatible structure
343- // see https://py3c.readthedocs.io/en/latest/ext-types.html#pynumbermethods
345+ /* Py2/3 compatible structure
346+ * see https://py3c.readthedocs.io/en/latest/ext-types.html#pynumbermethods
347+ */
344348PyNumberMethods TreeEntry_as_number = {
345349 0 , /* nb_add */
346350 0 , /* nb_subtract */
@@ -479,7 +483,7 @@ wrap_tree_entry(const git_tree_entry *entry, Repository *repo)
479483 if (py_entry )
480484 {
481485 py_entry -> entry = entry ;
482- py_entry -> repo = repo ; // can be NULL
486+ py_entry -> repo = repo ; /* can be NULL */
483487 Py_XINCREF (repo );
484488 }
485489
@@ -790,8 +794,9 @@ PyMethodDef Tree_methods[] = {
790794 {NULL }
791795};
792796
793- // Py2/3 compatible structure
794- // see https://py3c.readthedocs.io/en/latest/ext-types.html#pynumbermethods
797+ /* Py2/3 compatible structure
798+ * see https://py3c.readthedocs.io/en/latest/ext-types.html#pynumbermethods
799+ */
795800PyNumberMethods Tree_as_number = {
796801 0 , /* nb_add */
797802 0 , /* nb_subtract */
0 commit comments