[Python-checkins] python/dist/src/Include object.h,2.105,2.106

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Tue, 09 Jul 2002 23:34:22 -0700


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

Modified Files:
	object.h 
Log Message:
Uglified the new Py_REF_DEBUG (etc) lexical helper macro definitions so
that their uses can be prettier.  I've come to despise the names I picked
for these things, though, and expect to change all of them -- I changed
a bunch of other files to use them (replacing #ifdef blocks), but the
names were so obscure out of context that I backed that all out again.


Index: object.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/object.h,v
retrieving revision 2.105
retrieving revision 2.106
diff -C2 -d -r2.105 -r2.106
*** object.h	9 Jul 2002 02:57:01 -0000	2.105
--- object.h	10 Jul 2002 06:34:15 -0000	2.106
***************
*** 543,547 ****
  #define _PyMAYBE_BUMP_REFTOTAL		_Py_RefTotal++
  #define _PyMAYBE_DROP_REFTOTAL		_Py_RefTotal--
! #define _PyMAYBE_REFTOTAL_COMMA		,
  #define _PyMAYBE_CHECK_REFCNT(OP)				\
  {	if ((OP)->ob_refcnt < 0)				\
--- 543,548 ----
  #define _PyMAYBE_BUMP_REFTOTAL		_Py_RefTotal++
  #define _PyMAYBE_DROP_REFTOTAL		_Py_RefTotal--
! #define _PyMAYBE_BUMP_REFTOTAL_COMMA	_PyMAYBE_BUMP_REFTOTAL ,
! #define _PyMAYBE_DROP_REFTOTAL_COMMA	_PyMAYBE_DROP_REFTOTAL ,
  #define _PyMAYBE_CHECK_REFCNT(OP)				\
  {	if ((OP)->ob_refcnt < 0)				\
***************
*** 552,558 ****
  #define _PyMAYBE_BUMP_REFTOTAL
  #define _PyMAYBE_DROP_REFTOTAL
! #define _PyMAYBE_REFTOTAL_COMMA
! #define _PyMAYBE_CHECK_REFCNT(OP)	;
! #endif
  
  #ifdef COUNT_ALLOCS
--- 553,560 ----
  #define _PyMAYBE_BUMP_REFTOTAL
  #define _PyMAYBE_DROP_REFTOTAL
! #define _PyMAYBE_BUMP_REFTOTAL_COMMA
! #define _PyMAYBE_DROP_REFTOTAL_COMMA
! #define _PyMAYBE_CHECK_REFCNT(OP)	/* a semicolon */;
! #endif /* Py_REF_DEBUG */
  
  #ifdef COUNT_ALLOCS
***************
*** 560,571 ****
  #define _PyMAYBE_BUMP_COUNT(OP)		inc_count((OP)->ob_type)
  #define _PyMAYBE_BUMP_FREECOUNT(OP)	(OP)->ob_type->tp_frees++
! #define _PyMAYBE_BUMP_COUNT_COMMA	,
! #define _PyMAYBE_BUMP_FREECOUNT_COMMA	,
  #else
  #define _PyMAYBE_BUMP_COUNT(OP)
  #define _PyMAYBE_BUMP_FREECOUNT(OP)
! #define _PyMAYBE_BUMP_COUNT_COMMA
! #define _PyMAYBE_BUMP_FREECOUNT_COMMA
! #endif
  
  #ifdef Py_TRACE_REFS
--- 562,575 ----
  #define _PyMAYBE_BUMP_COUNT(OP)		inc_count((OP)->ob_type)
  #define _PyMAYBE_BUMP_FREECOUNT(OP)	(OP)->ob_type->tp_frees++
! #define _PyMAYBE_DROP_FREECOUNT(OP)	(OP)->ob_type->tp_frees--
! #define _PyMAYBE_BUMP_COUNT_COMMA(OP)	_PyMAYBE_BUMP_COUNT(OP) ,
! #define _PyMAYBE_BUMP_FREECOUNT_COMMA(OP) _PyMAYBE_BUMP_FREECOUNT(OP) ,
  #else
  #define _PyMAYBE_BUMP_COUNT(OP)
  #define _PyMAYBE_BUMP_FREECOUNT(OP)
! #define _PyMAYBE_DROP_FREECOUNT(OP)
! #define _PyMAYBE_BUMP_COUNT_COMMA(OP)
! #define _PyMAYBE_BUMP_FREECOUNT_COMMA(OP)
! #endif /* COUNT_ALLOCS */
  
  #ifdef Py_TRACE_REFS
***************
*** 581,605 ****
   * inline.
   */
! #define _Py_NewReference(op) (					\
! 	_PyMAYBE_BUMP_COUNT(op) _PyMAYBE_BUMP_COUNT_COMMA	\
! 	_PyMAYBE_BUMP_REFTOTAL _PyMAYBE_REFTOTAL_COMMA		\
  	(op)->ob_refcnt = 1)
  
  #define _Py_ForgetReference(op) _PyMAYBE_BUMP_FREECOUNT(op)
  
! #define _Py_Dealloc(op) (						\
! 	_PyMAYBE_BUMP_FREECOUNT(op) _PyMAYBE_BUMP_FREECOUNT_COMMA	\
  	(*(op)->ob_type->tp_dealloc)((PyObject *)(op)))
  #endif /* !Py_TRACE_REFS */
  
! #define Py_INCREF(op) (						\
! 	_PyMAYBE_BUMP_REFTOTAL _PyMAYBE_REFTOTAL_COMMA		\
  	(op)->ob_refcnt++)
  
! #define Py_DECREF(op)						\
! 	if (_PyMAYBE_DROP_REFTOTAL _PyMAYBE_REFTOTAL_COMMA	\
! 	    --(op)->ob_refcnt != 0)				\
! 		_PyMAYBE_CHECK_REFCNT(op)			\
! 	else							\
  		_Py_Dealloc((PyObject *)(op))
  
--- 585,609 ----
   * inline.
   */
! #define _Py_NewReference(op) (		\
! 	_PyMAYBE_BUMP_COUNT_COMMA(op)	\
! 	_PyMAYBE_BUMP_REFTOTAL_COMMA	\
  	(op)->ob_refcnt = 1)
  
  #define _Py_ForgetReference(op) _PyMAYBE_BUMP_FREECOUNT(op)
  
! #define _Py_Dealloc(op) (				\
! 	_PyMAYBE_BUMP_FREECOUNT_COMMA(op)		\
  	(*(op)->ob_type->tp_dealloc)((PyObject *)(op)))
  #endif /* !Py_TRACE_REFS */
  
! #define Py_INCREF(op) (			\
! 	_PyMAYBE_BUMP_REFTOTAL_COMMA	\
  	(op)->ob_refcnt++)
  
! #define Py_DECREF(op)				\
! 	if (_PyMAYBE_DROP_REFTOTAL_COMMA	\
! 	    --(op)->ob_refcnt != 0)		\
! 		_PyMAYBE_CHECK_REFCNT(op)	\
! 	else					\
  		_Py_Dealloc((PyObject *)(op))