[Python-checkins] CVS: python/dist/src/Include pymem.h,2.6,2.7

Neil Schemenauer nascheme@users.sourceforge.net
Mon, 18 Mar 2002 13:04:56 -0800


Update of /cvsroot/python/python/dist/src/Include
In directory usw-pr-cvs1:/tmp/cvs-serv31099/Include

Modified Files:
	pymem.h 
Log Message:
Drop the PyCore_* memory API.


Index: pymem.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/pymem.h,v
retrieving revision 2.6
retrieving revision 2.7
diff -C2 -d -r2.6 -r2.7
*** pymem.h	18 Mar 2002 18:12:58 -0000	2.6
--- pymem.h	18 Mar 2002 21:04:54 -0000	2.7
***************
*** 11,34 ****
  #endif
  
- /*
-  * Core memory allocator
-  * =====================
-  */
- 
- /* To make sure the interpreter is user-malloc friendly, all memory
-    APIs are implemented on top of this one.
- 
-    The PyCore_* macros can be defined to make the interpreter use a
-    custom allocator. Note that they are for internal use only. Both
-    the core and extension modules should use the PyMem_* API. */
- 
- #ifndef PyCore_MALLOC
- #undef PyCore_REALLOC
- #undef PyCore_FREE
- #define PyCore_MALLOC(n)      malloc(n)
- #define PyCore_REALLOC(p, n)  realloc((p), (n))
- #define PyCore_FREE(p)        free(p)
- #endif
- 
  /* BEWARE:
  
--- 11,14 ----
***************
*** 52,58 ****
   */
  
  /* Functions */
  
! /* Function wrappers around PyCore_MALLOC and friends; useful if you
     need to be sure that you are using the same memory allocator as
     Python.  Note that the wrappers make sure that allocating 0 bytes
--- 32,41 ----
   */
  
+ /* To make sure the interpreter is user-malloc friendly, all memory
+    APIs are implemented on top of this one. */
+ 
  /* Functions */
  
! /* Function wrappers around PyMem_MALLOC and friends; useful if you
     need to be sure that you are using the same memory allocator as
     Python.  Note that the wrappers make sure that allocating 0 bytes
***************
*** 67,74 ****
     no longer supported. They used to call PyErr_NoMemory() on failure. */
  
! /* Macros */
! #define PyMem_MALLOC(n)         PyCore_MALLOC(n)
! #define PyMem_REALLOC(p, n)     PyCore_REALLOC((void *)(p), (n))
! #define PyMem_FREE(p)           PyCore_FREE((void *)(p))
  
  /*
--- 50,59 ----
     no longer supported. They used to call PyErr_NoMemory() on failure. */
  
! /* Macros (override these if you want to a different malloc */
! #ifndef PyMem_MALLOC
! #define PyMem_MALLOC(n)         malloc(n)
! #define PyMem_REALLOC(p, n)     realloc((void *)(p), (n))
! #define PyMem_FREE(p)           free((void *)(p))
! #endif
  
  /*
***************
*** 104,107 ****
--- 89,108 ----
     it is recommended to write the test explicitly in the code.
     Note that according to ANSI C, free(NULL) has no effect. */
+ 
+ 	
+ /* pymalloc (private to the interpreter) */
+ #ifdef WITH_PYMALLOC
+ void *_PyMalloc_Malloc(size_t nbytes);
+ void *_PyMalloc_Realloc(void *p, size_t nbytes);
+ void _PyMalloc_Free(void *p);
+ #define _PyMalloc_MALLOC _PyMalloc_Malloc
+ #define _PyMalloc_REALLOC _PyMalloc_Realloc
+ #define _PyMalloc_FREE _PyMalloc_Free
+ #else
+ #define _PyMalloc_MALLOC PyMem_MALLOC
+ #define _PyMalloc_REALLOC PyMem_REALLOC
+ #define _PyMalloc_FREE PyMem_FREE
+ #endif
+ 
  
  #ifdef __cplusplus