diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2002-11-23 09:13:40 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2002-11-23 09:13:40 (GMT) |
commit | 39f59b089dde8c4badaa510dd47d6d93d5eaed3d (patch) | |
tree | 4b5aaeb5f2b479a161873c060cbfd16a2d591fb3 /Include/pymem.h | |
parent | 19cf4ee69d414b3bf849cb2a4f00bfed70f1c76b (diff) | |
download | cpython-39f59b089dde8c4badaa510dd47d6d93d5eaed3d.zip cpython-39f59b089dde8c4badaa510dd47d6d93d5eaed3d.tar.gz cpython-39f59b089dde8c4badaa510dd47d6d93d5eaed3d.tar.bz2 |
Remove MALLOC_ZERO_RETURNS_NULL.
Diffstat (limited to 'Include/pymem.h')
-rw-r--r-- | Include/pymem.h | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/Include/pymem.h b/Include/pymem.h index 6b1105c..f8aef29 100644 --- a/Include/pymem.h +++ b/Include/pymem.h @@ -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 */ |