@@ -1296,35 +1296,33 @@ _PyInt_Init(void)
12961296 return 1 ;
12971297}
12981298
1299- void
1300- PyInt_CompactFreeList ( size_t * pbc , size_t * pbf , size_t * bsum )
1299+ int
1300+ PyInt_ClearFreeList ( void )
13011301{
13021302 PyIntObject * p ;
13031303 PyIntBlock * list , * next ;
1304- unsigned int ctr ;
1305- size_t bc = 0 , bf = 0 ; /* block count, number of freed blocks */
1306- size_t isum = 0 ; /* total unfreed ints */
1307- int irem ; /* remaining unfreed ints per block */
1304+ int i ;
1305+ int u ; /* remaining unfreed ints per block */
1306+ int freelist_size = 0 ;
13081307
13091308 list = block_list ;
13101309 block_list = NULL ;
13111310 free_list = NULL ;
13121311 while (list != NULL ) {
1313- bc ++ ;
1314- irem = 0 ;
1315- for (ctr = 0 , p = & list -> objects [0 ];
1316- ctr < N_INTOBJECTS ;
1317- ctr ++ , p ++ ) {
1312+ u = 0 ;
1313+ for (i = 0 , p = & list -> objects [0 ];
1314+ i < N_INTOBJECTS ;
1315+ i ++ , p ++ ) {
13181316 if (PyInt_CheckExact (p ) && p -> ob_refcnt != 0 )
1319- irem ++ ;
1317+ u ++ ;
13201318 }
13211319 next = list -> next ;
1322- if (irem ) {
1320+ if (u ) {
13231321 list -> next = block_list ;
13241322 block_list = list ;
1325- for (ctr = 0 , p = & list -> objects [0 ];
1326- ctr < N_INTOBJECTS ;
1327- ctr ++ , p ++ ) {
1323+ for (i = 0 , p = & list -> objects [0 ];
1324+ i < N_INTOBJECTS ;
1325+ i ++ , p ++ ) {
13281326 if (!PyInt_CheckExact (p ) ||
13291327 p -> ob_refcnt == 0 ) {
13301328 Py_TYPE (p ) = (struct _typeobject * )
@@ -1345,28 +1343,23 @@ PyInt_CompactFreeList(size_t *pbc, size_t *pbf, size_t *bsum)
13451343 }
13461344 else {
13471345 PyMem_FREE (list );
1348- bf ++ ;
13491346 }
1350- isum += irem ;
1347+ freelist_size += u ;
13511348 list = next ;
13521349 }
13531350
1354- * pbc = bc ;
1355- * pbf = bf ;
1356- * bsum = isum ;
1351+ return freelist_size ;
13571352}
13581353
13591354void
13601355PyInt_Fini (void )
13611356{
13621357 PyIntObject * p ;
13631358 PyIntBlock * list ;
1364- unsigned int ctr ;
1365- size_t bc , bf ; /* block count, number of freed blocks */
1366- size_t isum ; /* total unfreed ints per block */
1359+ int i ;
1360+ int u ; /* total unfreed ints per block */
13671361
13681362#if NSMALLNEGINTS + NSMALLPOSINTS > 0
1369- int i ;
13701363 PyIntObject * * q ;
13711364
13721365 i = NSMALLNEGINTS + NSMALLPOSINTS ;
@@ -1376,27 +1369,24 @@ PyInt_Fini(void)
13761369 * q ++ = NULL ;
13771370 }
13781371#endif
1379- PyInt_CompactFreeList ( & bc , & bf , & isum );
1372+ u = PyInt_ClearFreeList ( );
13801373 if (!Py_VerboseFlag )
13811374 return ;
13821375 fprintf (stderr , "# cleanup ints" );
1383- if (!isum ) {
1376+ if (!u ) {
13841377 fprintf (stderr , "\n" );
13851378 }
13861379 else {
13871380 fprintf (stderr ,
1388- ": %" PY_FORMAT_SIZE_T "d unfreed int%s in %"
1389- PY_FORMAT_SIZE_T "d out of %"
1390- PY_FORMAT_SIZE_T "d block%s\n" ,
1391- isum , isum == 1 ? "" : "s" ,
1392- bc - bf , bc , bc == 1 ? "" : "s" );
1381+ ": %d unfreed int%s\n" ,
1382+ u , u == 1 ? "" : "s" );
13931383 }
13941384 if (Py_VerboseFlag > 1 ) {
13951385 list = block_list ;
13961386 while (list != NULL ) {
1397- for (ctr = 0 , p = & list -> objects [0 ];
1398- ctr < N_INTOBJECTS ;
1399- ctr ++ , p ++ ) {
1387+ for (i = 0 , p = & list -> objects [0 ];
1388+ i < N_INTOBJECTS ;
1389+ i ++ , p ++ ) {
14001390 if (PyInt_CheckExact (p ) && p -> ob_refcnt != 0 )
14011391 /* XXX(twouters) cast refcount to
14021392 long until %zd is universally
0 commit comments