Skip to content

Commit 3835dfc

Browse files
committed
gh-90815: Fix _PyMem_MimallocEnabled() compiler warning
Don't declare _PyMem_MimallocEnabled() if WITH_PYMALLOC macro is not defined (./configure --without-pymalloc). Fix also a typo in _PyInterpreterState_FinalizeAllocatedBlocks().
1 parent c4dc5a6 commit 3835dfc

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Objects/obmalloc.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -561,14 +561,13 @@ _PyMem_GetCurrentAllocatorName(void)
561561
}
562562

563563

564-
#if defined(WITH_PYMALLOC) || defined(WITH_MIMALLOC)
564+
#ifdef WITH_PYMALLOC
565565
static int
566566
_PyMem_DebugEnabled(void)
567567
{
568568
return (_PyObject.malloc == _PyMem_DebugMalloc);
569569
}
570570

571-
#ifdef WITH_PYMALLOC
572571
static int
573572
_PyMem_PymallocEnabled(void)
574573
{
@@ -579,7 +578,7 @@ _PyMem_PymallocEnabled(void)
579578
return (_PyObject.malloc == _PyObject_Malloc);
580579
}
581580
}
582-
#endif
581+
583582
#ifdef WITH_MIMALLOC
584583
static int
585584
_PyMem_MimallocEnabled(void)
@@ -591,8 +590,9 @@ _PyMem_MimallocEnabled(void)
591590
return (_PyObject.malloc == _PyObject_MiMalloc);
592591
}
593592
}
594-
#endif
595-
#endif // defined(WITH_PYMALLOC) || defined(WITH_MIMALLOC)
593+
#endif // WITH_MIMALLOC
594+
595+
#endif // WITH_PYMALLOC
596596

597597

598598
static void
@@ -1073,7 +1073,7 @@ _PyInterpreterState_GetAllocatedBlocks(PyInterpreterState *interp)
10731073
void
10741074
_PyInterpreterState_FinalizeAllocatedBlocks(PyInterpreterState *interp)
10751075
{
1076-
#ifdef WITH_MIAMLLOC
1076+
#ifdef WITH_MIMALLOC
10771077
if (_PyMem_MimallocEnabled()) {
10781078
return;
10791079
}

0 commit comments

Comments
 (0)