[Python-checkins] python/dist/src/Include objimpl.h,2.49,2.50

tim_one@sourceforge.net tim_one@sourceforge.net
Thu, 11 Apr 2002 22:21:36 -0700


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

Modified Files:
	objimpl.h 
Log Message:
First cut at repairing out-of-date comments; make alignment of macro defs
all the same within the #ifdef WITH_PYMALLOC block.


Index: objimpl.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/objimpl.h,v
retrieving revision 2.49
retrieving revision 2.50
diff -C2 -d -r2.49 -r2.50
*** objimpl.h	12 Apr 2002 02:38:45 -0000	2.49
--- objimpl.h	12 Apr 2002 05:21:34 -0000	2.50
***************
*** 18,23 ****
     type object.  Reference count and type pointer are filled in; the
     rest of the bytes of the object are *undefined*!  The resulting
!    expression type is 'type *'.  The size of the object is actually
!    determined by the tp_basicsize field of the type object.
  
   - PyObject_NewVar(type, typeobj, n) is similar but allocates a
--- 18,23 ----
     type object.  Reference count and type pointer are filled in; the
     rest of the bytes of the object are *undefined*!  The resulting
!    expression type is 'type *'.  The size of the object is determined
!    by the tp_basicsize field of the type object.
  
   - PyObject_NewVar(type, typeobj, n) is similar but allocates a
***************
*** 26,30 ****
     as well.
  
!  - PyObject_Del(op) releases the memory allocated for an object.
  
   - PyObject_Init(op, typeobj) and PyObject_InitVar(op, typeobj, n) are
--- 26,32 ----
     as well.
  
!  - PyObject_Del(op) releases the memory allocated for an object.  It
!    does not run a destructor -- it only frees the memory.  PyObject_Free
!    is identical.
  
   - PyObject_Init(op, typeobj) and PyObject_InitVar(op, typeobj, n) are
***************
*** 35,39 ****
  
  Note that objects created with PyObject_{New, NewVar} are allocated
! using the specialized Python allocator (implemented in obmalloc.c).
  
  In case a specific form of memory management is needed, implying that
--- 37,43 ----
  
  Note that objects created with PyObject_{New, NewVar} are allocated
! using the specialized Python allocator (implemented in obmalloc.c), if
! WITH_PYMALLOC is enabled.  In addition, a special debugging allocator
! is used if PYMALLOC_DEBUG is also #defined.
  
  In case a specific form of memory management is needed, implying that
***************
*** 71,79 ****
  /* Functions */
  
! /* Wrappers that useful if you need to be sure that you are using the
!    same object memory allocator as Python. These wrappers *do not* make
!    sure that allocating 0 bytes returns a non-NULL pointer. Returned
!    pointers must be checked for NULL explicitly; no action is performed
!    on failure. */
  extern DL_IMPORT(void *) PyObject_Malloc(size_t);
  extern DL_IMPORT(void *) PyObject_Realloc(void *, size_t);
--- 75,88 ----
  /* Functions */
  
! /* Functions to call the same malloc/realloc/free as used by Python's
!    object allocator.  If WITH_PYMALLOC is enabled, these may differ from
!    the platform malloc/realloc/free.  The Python object allocator is
!    designed for fast, cache-conscious allocation of many "small" objects,
!    with low hidden memory overhead.  PyObject_Malloc(0) returns a unique
!    non-NULL pointer if possible.  PyObject_Realloc(NULL, n) acts like
!    PyObject_Malloc(n).  PyObject_Realloc(p != NULL, 0) does not return
!    NULL or free the memory at p.  Returned pointers must be checked for
!    NULL explicitly; no action is performed on failure other than to return
!    NULL. */
  extern DL_IMPORT(void *) PyObject_Malloc(size_t);
  extern DL_IMPORT(void *) PyObject_Realloc(void *, size_t);
***************
*** 90,99 ****
  DL_IMPORT(void) _PyObject_DebugCheckAddress(const void *p);
  DL_IMPORT(void) _PyObject_DebugDumpStats(void);
! #define PyObject_MALLOC _PyObject_DebugMalloc
! #define PyObject_Malloc _PyObject_DebugMalloc
! #define PyObject_REALLOC _PyObject_DebugRealloc
! #define PyObject_Realloc _PyObject_DebugRealloc
! #define PyObject_FREE _PyObject_DebugFree
! #define PyObject_Free _PyObject_DebugFree
  
  #else	/* WITH_PYMALLOC && ! PYMALLOC_DEBUG */
--- 99,108 ----
  DL_IMPORT(void) _PyObject_DebugCheckAddress(const void *p);
  DL_IMPORT(void) _PyObject_DebugDumpStats(void);
! #define PyObject_MALLOC		_PyObject_DebugMalloc
! #define PyObject_Malloc		_PyObject_DebugMalloc
! #define PyObject_REALLOC	_PyObject_DebugRealloc
! #define PyObject_Realloc	_PyObject_DebugRealloc
! #define PyObject_FREE		_PyObject_DebugFree
! #define PyObject_Free		_PyObject_DebugFree
  
  #else	/* WITH_PYMALLOC && ! PYMALLOC_DEBUG */