Skip to content

Commit 535a873

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 535a873

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Objects/obmalloc.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -561,14 +561,14 @@ _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
571+
572572
static int
573573
_PyMem_PymallocEnabled(void)
574574
{
@@ -579,7 +579,8 @@ _PyMem_PymallocEnabled(void)
579579
return (_PyObject.malloc == _PyObject_Malloc);
580580
}
581581
}
582-
#endif
582+
583+
583584
#ifdef WITH_MIMALLOC
584585
static int
585586
_PyMem_MimallocEnabled(void)
@@ -591,8 +592,9 @@ _PyMem_MimallocEnabled(void)
591592
return (_PyObject.malloc == _PyObject_MiMalloc);
592593
}
593594
}
594-
#endif
595-
#endif // defined(WITH_PYMALLOC) || defined(WITH_MIMALLOC)
595+
#endif // WITH_MIMALLOC
596+
597+
#endif // WITH_PYMALLOC
596598

597599

598600
static void
@@ -1073,7 +1075,7 @@ _PyInterpreterState_GetAllocatedBlocks(PyInterpreterState *interp)
10731075
void
10741076
_PyInterpreterState_FinalizeAllocatedBlocks(PyInterpreterState *interp)
10751077
{
1076-
#ifdef WITH_MIAMLLOC
1078+
#ifdef WITH_MIMALLOC
10771079
if (_PyMem_MimallocEnabled()) {
10781080
return;
10791081
}

0 commit comments

Comments
 (0)