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:
parent
6be6c69292
commit
a113094a56
1 changed files with 6 additions and 1 deletions
|
@ -317,14 +317,19 @@ void * FixedAllocator::Allocate( void )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( allocChunk_ == emptyChunk_)
|
else if ( allocChunk_ == emptyChunk_)
|
||||||
|
// detach emptyChunk_ from allocChunk_, because after
|
||||||
|
// calling allocChunk_->Allocate(blockSize_); the chunk
|
||||||
|
// isn't any more empty
|
||||||
emptyChunk_ = NULL;
|
emptyChunk_ = NULL;
|
||||||
|
|
||||||
|
void *place = allocChunk_->Allocate(blockSize_);
|
||||||
|
|
||||||
assert( allocChunk_ != NULL );
|
assert( allocChunk_ != NULL );
|
||||||
assert( !allocChunk_->IsFilled() );
|
assert( !allocChunk_->IsFilled() );
|
||||||
// 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_ ) ) );
|
||||||
|
|
||||||
return allocChunk_->Allocate(blockSize_);
|
return place;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue