@@ -228,6 +228,7 @@ void NpyArr_iterBegin(JSOBJ _obj, JSONTypeContext *tc)
228
228
{
229
229
PyArrayObject * obj ;
230
230
PyArray_Descr * dtype ;
231
+ NpyArrContext * npyarr ;
231
232
232
233
if (GET_TC (tc )-> newObj )
233
234
{
@@ -241,7 +242,7 @@ void NpyArr_iterBegin(JSOBJ _obj, JSONTypeContext *tc)
241
242
if (PyArray_SIZE (obj ) > 0 )
242
243
{
243
244
PRINTMARK ();
244
- NpyArrContext * npyarr = PyObject_Malloc (sizeof (NpyArrContext ));
245
+ npyarr = PyObject_Malloc (sizeof (NpyArrContext ));
245
246
GET_TC (tc )-> npyarr = npyarr ;
246
247
247
248
if (!npyarr )
@@ -321,9 +322,10 @@ void NpyArrPassThru_iterBegin(JSOBJ obj, JSONTypeContext *tc)
321
322
322
323
void NpyArrPassThru_iterEnd (JSOBJ obj , JSONTypeContext * tc )
323
324
{
325
+ NpyArrContext * npyarr ;
324
326
PRINTMARK ();
325
327
// finished this dimension, reset the data pointer
326
- NpyArrContext * npyarr = GET_TC (tc )-> npyarr ;
328
+ npyarr = GET_TC (tc )-> npyarr ;
327
329
npyarr -> curdim -- ;
328
330
npyarr -> dataptr -= npyarr -> stride * npyarr -> index [npyarr -> stridedim ];
329
331
npyarr -> stridedim -= npyarr -> inc ;
@@ -340,8 +342,9 @@ void NpyArrPassThru_iterEnd(JSOBJ obj, JSONTypeContext *tc)
340
342
341
343
int NpyArr_iterNextItem (JSOBJ _obj , JSONTypeContext * tc )
342
344
{
345
+ NpyArrContext * npyarr ;
343
346
PRINTMARK ();
344
- NpyArrContext * npyarr = GET_TC (tc )-> npyarr ;
347
+ npyarr = GET_TC (tc )-> npyarr ;
345
348
346
349
if (GET_TC (tc )-> itemValue != npyarr -> array )
347
350
{
@@ -363,8 +366,9 @@ int NpyArr_iterNextItem(JSOBJ _obj, JSONTypeContext *tc)
363
366
364
367
int NpyArr_iterNext (JSOBJ _obj , JSONTypeContext * tc )
365
368
{
369
+ NpyArrContext * npyarr ;
366
370
PRINTMARK ();
367
- NpyArrContext * npyarr = GET_TC (tc )-> npyarr ;
371
+ npyarr = GET_TC (tc )-> npyarr ;
368
372
369
373
if (npyarr -> curdim >= npyarr -> ndim || npyarr -> index [npyarr -> stridedim ] >= npyarr -> dim )
370
374
{
@@ -395,8 +399,9 @@ JSOBJ NpyArr_iterGetValue(JSOBJ obj, JSONTypeContext *tc)
395
399
396
400
char * NpyArr_iterGetName (JSOBJ obj , JSONTypeContext * tc , size_t * outLen )
397
401
{
402
+ NpyArrContext * npyarr ;
398
403
PRINTMARK ();
399
- NpyArrContext * npyarr = GET_TC (tc )-> npyarr ;
404
+ npyarr = GET_TC (tc )-> npyarr ;
400
405
npy_intp idx ;
401
406
if (GET_TC (tc )-> iterNext == NpyArr_iterNextItem )
402
407
{
@@ -483,6 +488,8 @@ int Dir_iterNext(JSOBJ _obj, JSONTypeContext *tc)
483
488
PyObject * obj = (PyObject * ) _obj ;
484
489
PyObject * itemValue = GET_TC (tc )-> itemValue ;
485
490
PyObject * itemName = NULL ;
491
+ PyObject * attr ;
492
+ char * attrStr ;
486
493
487
494
488
495
if (itemValue )
@@ -493,8 +500,8 @@ int Dir_iterNext(JSOBJ _obj, JSONTypeContext *tc)
493
500
494
501
for (; GET_TC (tc )-> index < GET_TC (tc )-> size ; GET_TC (tc )-> index ++ )
495
502
{
496
- PyObject * attr = PyList_GET_ITEM (GET_TC (tc )-> attrList , GET_TC (tc )-> index );
497
- char * attrStr = PyString_AS_STRING (attr );
503
+ attr = PyList_GET_ITEM (GET_TC (tc )-> attrList , GET_TC (tc )-> index );
504
+ attrStr = PyString_AS_STRING (attr );
498
505
499
506
if (attrStr [0 ] == '_' )
500
507
{
@@ -608,12 +615,13 @@ void Index_iterBegin(JSOBJ obj, JSONTypeContext *tc)
608
615
609
616
int Index_iterNext (JSOBJ obj , JSONTypeContext * tc )
610
617
{
618
+ Py_ssize_t index ;
611
619
if (!GET_TC (tc )-> citemName )
612
620
{
613
621
return 0 ;
614
622
}
615
623
616
- Py_ssize_t index = GET_TC (tc )-> index ;
624
+ index = GET_TC (tc )-> index ;
617
625
Py_XDECREF (GET_TC (tc )-> itemValue );
618
626
if (index == 0 )
619
627
{
@@ -675,12 +683,13 @@ void Series_iterBegin(JSOBJ obj, JSONTypeContext *tc)
675
683
676
684
int Series_iterNext (JSOBJ obj , JSONTypeContext * tc )
677
685
{
686
+ Py_ssize_t index ;
678
687
if (!GET_TC (tc )-> citemName )
679
688
{
680
689
return 0 ;
681
690
}
682
691
683
- Py_ssize_t index = GET_TC (tc )-> index ;
692
+ index = GET_TC (tc )-> index ;
684
693
Py_XDECREF (GET_TC (tc )-> itemValue );
685
694
if (index == 0 )
686
695
{
@@ -750,12 +759,13 @@ void DataFrame_iterBegin(JSOBJ obj, JSONTypeContext *tc)
750
759
751
760
int DataFrame_iterNext (JSOBJ obj , JSONTypeContext * tc )
752
761
{
762
+ Py_ssize_t index ;
753
763
if (!GET_TC (tc )-> citemName )
754
764
{
755
765
return 0 ;
756
766
}
757
767
758
- Py_ssize_t index = GET_TC (tc )-> index ;
768
+ index = GET_TC (tc )-> index ;
759
769
Py_XDECREF (GET_TC (tc )-> itemValue );
760
770
if (index == 0 )
761
771
{
0 commit comments