@@ -43,7 +43,7 @@ extern PyTypeObject TreeIterType;
43
43
extern PyTypeObject IndexType ;
44
44
45
45
#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 */
47
47
#endif
48
48
49
49
@@ -184,6 +184,7 @@ treeentry_to_subtree(TreeEntry* self)
184
184
{
185
185
Repository * py_repo ;
186
186
git_tree * subtree = NULL ;
187
+ int err ;
187
188
188
189
if (git_tree_entry_type (self -> entry ) != GIT_OBJ_TREE ) {
189
190
PyErr_SetString (PyExc_TypeError , "Only for trees" );
@@ -196,7 +197,7 @@ treeentry_to_subtree(TreeEntry* self)
196
197
}
197
198
198
199
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 ));
200
201
if (err < 0 ) {
201
202
Error_set (err );
202
203
return NULL ;
@@ -210,14 +211,15 @@ treeentry_to_object(TreeEntry* self)
210
211
{
211
212
Repository * py_repo ;
212
213
git_object * obj = NULL ;
214
+ int err ;
213
215
214
216
if (self -> repo == NULL ) {
215
217
PyErr_SetString (PyExc_ValueError , "No repository associated with this TreeEntry" );
216
218
return NULL ;
217
219
}
218
220
py_repo = self -> repo ;
219
221
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 );
221
223
if (err < 0 ) {
222
224
Error_set (err );
223
225
return NULL ;
@@ -230,8 +232,9 @@ PyDoc_STRVAR(TreeEntry_obj__doc__, "Object (subtree/blob)");
230
232
PyObject *
231
233
TreeEntry_obj__get__ (TreeEntry * self )
232
234
{
235
+ git_tree * subtree ;
233
236
if (git_tree_entry_type (self -> entry ) == GIT_OBJ_TREE ) {
234
- git_tree * subtree = treeentry_to_subtree (self );
237
+ subtree = treeentry_to_subtree (self );
235
238
if (subtree == NULL )
236
239
return NULL ;
237
240
@@ -339,8 +342,9 @@ PyMappingMethods TreeEntry_as_mapping = {
339
342
0 , /* mp_ass_subscript */
340
343
};
341
344
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
+ */
344
348
PyNumberMethods TreeEntry_as_number = {
345
349
0 , /* nb_add */
346
350
0 , /* nb_subtract */
@@ -479,7 +483,7 @@ wrap_tree_entry(const git_tree_entry *entry, Repository *repo)
479
483
if (py_entry )
480
484
{
481
485
py_entry -> entry = entry ;
482
- py_entry -> repo = repo ; // can be NULL
486
+ py_entry -> repo = repo ; /* can be NULL */
483
487
Py_XINCREF (repo );
484
488
}
485
489
@@ -790,8 +794,9 @@ PyMethodDef Tree_methods[] = {
790
794
{NULL }
791
795
};
792
796
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
+ */
795
800
PyNumberMethods Tree_as_number = {
796
801
0 , /* nb_add */
797
802
0 , /* nb_subtract */
0 commit comments