From 0699d642fd5ce408d96f1e0f2f3f35f48f527701 Mon Sep 17 00:00:00 2001 From: rich_sposato Date: Wed, 7 Mar 2007 00:30:12 +0000 Subject: [PATCH] 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 --- src/SmallObj.cpp | 8 ++++++++ src/StrongPtr.cpp | 15 --------------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/SmallObj.cpp b/src/SmallObj.cpp index ed4bc6a..5bc734c 100644 --- a/src/SmallObj.cpp +++ b/src/SmallObj.cpp @@ -24,6 +24,7 @@ //#define DO_EXTRA_LOKI_TESTS //#define USE_NEW_TO_ALLOCATE +//#define LOKI_CHECK_FOR_CORRUPTION #ifdef DO_EXTRA_LOKI_TESTS #include @@ -870,6 +871,13 @@ void * FixedAllocator::Allocate( void ) // prove either emptyChunk_ points nowhere, or points to a truly empty Chunk. assert( ( NULL == emptyChunk_ ) || ( emptyChunk_->HasAvailable( numBlocks_ ) ) ); assert( CountEmptyChunks() < 2 ); +#ifdef LOKI_CHECK_FOR_CORRUPTION + if ( allocChunk_->IsCorrupt( numBlocks_, blockSize_, true ) ) + { + assert( false ); + return NULL; + } +#endif return place; } diff --git a/src/StrongPtr.cpp b/src/StrongPtr.cpp index d70d200..4591c81 100644 --- a/src/StrongPtr.cpp +++ b/src/StrongPtr.cpp @@ -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 ) { if ( strong )