mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
bpo-36763: Add PyMemAllocatorName (GH-13387)
* Add PyMemAllocatorName enum * _PyPreConfig.allocator type becomes PyMemAllocatorName, instead of char* * Remove _PyPreConfig_Clear() * Add _PyMem_GetAllocatorName() * Rename _PyMem_GetAllocatorsName() to _PyMem_GetCurrentAllocatorName() * Remove _PyPreConfig_SetAllocator(): just call _PyMem_SetupAllocators() directly, we don't have do reallocate the configuration with the new allocator anymore! * _PyPreConfig_Write() parameter becomes const, as it should be in the first place!
This commit is contained in:
parent
80ed353329
commit
b16b4e4592
12 changed files with 119 additions and 112 deletions
|
@ -88,7 +88,6 @@ PyAPI_FUNC(_PyInitError) _PyPreCmdline_Read(_PyPreCmdline *cmdline,
|
|||
|
||||
/* --- _PyPreConfig ----------------------------------------------- */
|
||||
|
||||
PyAPI_FUNC(void) _PyPreConfig_Clear(_PyPreConfig *config);
|
||||
PyAPI_FUNC(int) _PyPreConfig_Copy(_PyPreConfig *config,
|
||||
const _PyPreConfig *config2);
|
||||
PyAPI_FUNC(PyObject*) _PyPreConfig_AsDict(const _PyPreConfig *config);
|
||||
|
@ -96,7 +95,7 @@ PyAPI_FUNC(void) _PyCoreConfig_GetCoreConfig(_PyPreConfig *config,
|
|||
const _PyCoreConfig *core_config);
|
||||
PyAPI_FUNC(_PyInitError) _PyPreConfig_Read(_PyPreConfig *config,
|
||||
const _PyArgv *args);
|
||||
PyAPI_FUNC(_PyInitError) _PyPreConfig_Write(_PyPreConfig *config);
|
||||
PyAPI_FUNC(_PyInitError) _PyPreConfig_Write(const _PyPreConfig *config);
|
||||
|
||||
|
||||
/* --- _PyCoreConfig ---------------------------------------------- */
|
||||
|
|
|
@ -179,6 +179,15 @@ static inline int _PyMem_IsPtrFreed(void *ptr)
|
|||
#endif
|
||||
}
|
||||
|
||||
PyAPI_FUNC(int) _PyMem_GetAllocatorName(
|
||||
const char *name,
|
||||
PyMemAllocatorName *allocator);
|
||||
|
||||
/* Configure the Python memory allocators.
|
||||
Pass PYMEM_ALLOCATOR_DEFAULT to use default allocators.
|
||||
PYMEM_ALLOCATOR_NOT_SET does nothing. */
|
||||
PyAPI_FUNC(int) _PyMem_SetupAllocators(PyMemAllocatorName allocator);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue