You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@locus.apache.org on 2000/12/05 16:32:58 UTC

cvs commit: xml-xalan/c/src/PlatformSupport XalanReferenceCountedObject.cpp

dbertoni    00/12/05 07:32:58

  Modified:    c/src/PlatformSupport XalanReferenceCountedObject.cpp
  Log:
  Added some safety assert.
  
  Revision  Changes    Path
  1.2       +13 -0     xml-xalan/c/src/PlatformSupport/XalanReferenceCountedObject.cpp
  
  Index: XalanReferenceCountedObject.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/XalanReferenceCountedObject.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XalanReferenceCountedObject.cpp	2000/11/21 21:07:44	1.1
  +++ XalanReferenceCountedObject.cpp	2000/12/05 15:32:58	1.2
  @@ -60,6 +60,14 @@
   
   
   
  +#include <cassert>
  +
  +#if !defined(NDEBUG)
  +#include <climits>
  +#endif
  +
  +
  +
   XalanReferenceCountedObject::XalanReferenceCountedObject() :
   	m_referenceCount(0)
   {
  @@ -69,6 +77,7 @@
   
   XalanReferenceCountedObject::~XalanReferenceCountedObject()
   {
  +	assert(m_referenceCount == 0);
   }	
   
   
  @@ -78,6 +87,8 @@
   {
   	if (theInstance != 0)
   	{
  +		assert(theInstance->m_referenceCount < UINT_MAX);
  +
   		if (++theInstance->m_referenceCount == 1)
   		{
   			theInstance->referenced();
  @@ -92,6 +103,8 @@
   {
   	if (theInstance != 0)
   	{
  +		assert(theInstance->m_referenceCount > 0);
  +
   		if (--theInstance->m_referenceCount == 0)
   		{
   			theInstance->dereferenced();