Mercurial > cpython-lru_cache-weakref
diff Include/mymalloc.h @ 2129:05360cd616ae legacy-trunk
The great renaming, phase two: all header files have been updated to
use the new names exclusively, and the linker will see the new names.
Files that import "Python.h" also only see the new names. Files that
import "allobjects.h" will continue to be able to use the old names,
due to the inclusion (in allobjects.h) of "rename2.h".
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Thu, 12 Jan 1995 11:45:45 +0000 |
| parents | ba3fd96f055e |
| children | 582b00fbab16 |
line wrap: on
line diff
--- a/Include/mymalloc.h Thu Jan 12 11:37:57 1995 +0000 +++ b/Include/mymalloc.h Thu Jan 12 11:45:45 1995 +0000 @@ -57,10 +57,10 @@ #endif #ifndef HAVE_STDLIB_H -extern ANY *malloc PROTO((size_t)); -extern ANY *calloc PROTO((size_t, size_t)); -extern ANY *realloc PROTO((ANY *, size_t)); -extern void free PROTO((ANY *)); /* XXX sometimes int on Unix old systems */ +extern ANY *malloc Py_PROTO((size_t)); +extern ANY *calloc Py_PROTO((size_t, size_t)); +extern ANY *realloc Py_PROTO((ANY *, size_t)); +extern void free Py_PROTO((ANY *)); /* XXX sometimes int on Unix old systems */ #endif /* !HAVE_STDLIB */ #ifndef NULL @@ -69,16 +69,20 @@ /* XXX Always allocate one extra byte, since some malloc's return NULL XXX for malloc(0) or realloc(p, 0). */ -#define NEW(type, n) ( (type *) malloc(1 + (n) * sizeof(type)) ) -#define RESIZE(p, type, n) \ +#define PyMem_NEW(type, n) ( (type *) malloc(1 + (n) * sizeof(type)) ) +#define PyMem_RESIZE(p, type, n) \ if ((p) == NULL) \ (p) = (type *) malloc(1 + (n) * sizeof(type)); \ else \ (p) = (type *) realloc((ANY *)(p), 1 + (n) * sizeof(type)) -#define DEL(p) free((ANY *)p) -#define XDEL(p) if ((p) == NULL) ; else DEL(p) +#define PyMem_DEL(p) free((ANY *)p) +#define PyMem_XDEL(p) if ((p) == NULL) ; else PyMem_DEL(p) #ifdef __cplusplus } #endif + +#ifndef Py_USE_NEW_NAMES +#include "rename2.h" +#endif #endif /* !Py_MYMALLOC_H */
