SmallObjects.cpp: move code before asserts, additional comments

git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@148 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
syntheticpp 2005-07-17 17:26:13 +00:00
parent 6be6c69292
commit a113094a56

View file

@ -317,14 +317,19 @@ void * FixedAllocator::Allocate( void )
}
}
else if ( allocChunk_ == emptyChunk_)
// detach emptyChunk_ from allocChunk_, because after
// calling allocChunk_->Allocate(blockSize_); the chunk
// isn't any more empty
emptyChunk_ = NULL;
void *place = allocChunk_->Allocate(blockSize_);
assert( allocChunk_ != NULL );
assert( !allocChunk_->IsFilled() );
// prove either emptyChunk_ points nowhere, or points to a truly empty Chunk.
assert( ( NULL == emptyChunk_ ) || ( emptyChunk_->HasAvailable( numBlocks_ ) ) );
return allocChunk_->Allocate(blockSize_);
return place;
}
////////////////////////////////////////////////////////////////////////////////