mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
Remove MALLOC_ZERO_RETURNS_NULL.
This commit is contained in:
parent
19cf4ee69d
commit
39f59b089d
6 changed files with 5 additions and 110 deletions
|
|
@ -62,16 +62,11 @@ PyAPI_FUNC(void) PyMem_Free(void *);
|
|||
|
||||
#else /* ! PYMALLOC_DEBUG */
|
||||
|
||||
#ifdef MALLOC_ZERO_RETURNS_NULL
|
||||
/* PyMem_MALLOC(0) means malloc(1). Some systems would return NULL
|
||||
for malloc(0), which would be treated as an error. Some platforms
|
||||
would return a pointer with no memory behind it, which would break
|
||||
pymalloc. To solve these problems, allocate an extra byte. */
|
||||
#define PyMem_MALLOC(n) malloc((n) ? (n) : 1)
|
||||
#else
|
||||
#define PyMem_MALLOC malloc
|
||||
#endif
|
||||
|
||||
/* Caution: whether MALLOC_ZERO_RETURNS_NULL is #defined has nothing to
|
||||
do with whether platform realloc(non-NULL, 0) normally frees the memory
|
||||
or returns NULL. Rather than introduce yet another config variation,
|
||||
just make a realloc to 0 bytes act as if to 1 instead. */
|
||||
#define PyMem_REALLOC(p, n) realloc((p), (n) ? (n) : 1)
|
||||
|
||||
#endif /* PYMALLOC_DEBUG */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue