Issue #18203: Add _PyMem_RawStrdup() and _PyMem_Strdup()

Replace strdup() with _PyMem_RawStrdup() or _PyMem_Strdup(), depending if the
GIL is held or not.
This commit is contained in:
Victor Stinner 2013-07-07 23:30:24 +02:00
parent 6f8eeee7b9
commit 49fc8ece81
8 changed files with 64 additions and 29 deletions

View file

@ -58,6 +58,9 @@ PyAPI_FUNC(void *) PyMem_Malloc(size_t size);
PyAPI_FUNC(void *) PyMem_Realloc(void *ptr, size_t new_size);
PyAPI_FUNC(void) PyMem_Free(void *ptr);
PyAPI_FUNC(char *) _PyMem_RawStrdup(const char *str);
PyAPI_FUNC(char *) _PyMem_Strdup(const char *str);
/* Macros. */
/* PyMem_MALLOC(0) means malloc(1). Some systems would return NULL