Changed TwoRefCounts dtor and minor change to SmallObj.cpp code.

git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@819 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
rich_sposato 2007-03-07 00:30:12 +00:00
parent dcf9d7f1d8
commit 0699d642fd
2 changed files with 8 additions and 15 deletions

View file

@ -24,6 +24,7 @@
//#define DO_EXTRA_LOKI_TESTS //#define DO_EXTRA_LOKI_TESTS
//#define USE_NEW_TO_ALLOCATE //#define USE_NEW_TO_ALLOCATE
//#define LOKI_CHECK_FOR_CORRUPTION
#ifdef DO_EXTRA_LOKI_TESTS #ifdef DO_EXTRA_LOKI_TESTS
#include <iostream> #include <iostream>
@ -870,6 +871,13 @@ void * FixedAllocator::Allocate( void )
// prove either emptyChunk_ points nowhere, or points to a truly empty Chunk. // prove either emptyChunk_ points nowhere, or points to a truly empty Chunk.
assert( ( NULL == emptyChunk_ ) || ( emptyChunk_->HasAvailable( numBlocks_ ) ) ); assert( ( NULL == emptyChunk_ ) || ( emptyChunk_->HasAvailable( numBlocks_ ) ) );
assert( CountEmptyChunks() < 2 ); assert( CountEmptyChunks() < 2 );
#ifdef LOKI_CHECK_FOR_CORRUPTION
if ( allocChunk_->IsCorrupt( numBlocks_, blockSize_, true ) )
{
assert( false );
return NULL;
}
#endif
return place; return place;
} }

View file

@ -57,21 +57,6 @@ TwoRefCounts::TwoRefCounts( const void * p, bool strong )
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
TwoRefCounts::~TwoRefCounts( void )
{
if ( m_counts == NULL )
{
return;
}
if ( !m_counts->HasStrongPointer() && !m_counts->HasWeakPointer() )
{
SmallObject<>::operator delete ( m_counts,
sizeof(Loki::Private::TwoRefCountInfo) );
}
}
// ----------------------------------------------------------------------------
void TwoRefCounts::Increment( bool strong ) void TwoRefCounts::Increment( bool strong )
{ {
if ( strong ) if ( strong )