[Python-checkins] python/dist/src/Include pymem.h,2.16,2.17
loewis@users.sourceforge.net
loewis@users.sourceforge.net
Sat, 23 Nov 2002 01:13:42 -0800
Update of /cvsroot/python/python/dist/src/Include
In directory sc8-pr-cvs1:/tmp/cvs-serv25570/Include
Modified Files:
pymem.h
Log Message:
Remove MALLOC_ZERO_RETURNS_NULL.
Index: pymem.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/pymem.h,v
retrieving revision 2.16
retrieving revision 2.17
diff -C2 -d -r2.16 -r2.17
*** pymem.h 12 Aug 2002 07:21:57 -0000 2.16
--- pymem.h 23 Nov 2002 09:13:40 -0000 2.17
***************
*** 63,76 ****
#else /* ! PYMALLOC_DEBUG */
! #ifdef MALLOC_ZERO_RETURNS_NULL
#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)
--- 63,71 ----
#else /* ! PYMALLOC_DEBUG */
! /* 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)
#define PyMem_REALLOC(p, n) realloc((p), (n) ? (n) : 1)