Replaced repeated calculation with local variable.
git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@1075 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
parent
d617910699
commit
ac54d187bc
1 changed files with 5 additions and 4 deletions
|
@ -943,18 +943,19 @@ bool FixedAllocator::Deallocate( void * p, Chunk * hint )
|
||||||
assert( CountEmptyChunks() < 2 );
|
assert( CountEmptyChunks() < 2 );
|
||||||
|
|
||||||
Chunk * foundChunk = nullptr;
|
Chunk * foundChunk = nullptr;
|
||||||
if ( ( nullptr != hint ) && ( hint->HasBlock( p, numBlocks_ * blockSize_ ) ) )
|
const ::std::size_t chunkLength = numBlocks_ * blockSize_;
|
||||||
|
if ( ( nullptr != hint ) && ( hint->HasBlock( p, chunkLength ) ) )
|
||||||
foundChunk = hint;
|
foundChunk = hint;
|
||||||
else if ( deallocChunk_->HasBlock( p, numBlocks_ * blockSize_ ) )
|
else if ( deallocChunk_->HasBlock( p, chunkLength ) )
|
||||||
foundChunk = deallocChunk_;
|
foundChunk = deallocChunk_;
|
||||||
else if ( allocChunk_->HasBlock( p, numBlocks_ * blockSize_ ) )
|
else if ( allocChunk_->HasBlock( p, chunkLength ) )
|
||||||
foundChunk = allocChunk_;
|
foundChunk = allocChunk_;
|
||||||
else
|
else
|
||||||
foundChunk = VicinityFind( p );
|
foundChunk = VicinityFind( p );
|
||||||
if ( nullptr == foundChunk )
|
if ( nullptr == foundChunk )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
assert( foundChunk->HasBlock( p, numBlocks_ * blockSize_ ) );
|
assert( foundChunk->HasBlock( p, chunkLength ) );
|
||||||
#ifdef LOKI_CHECK_FOR_CORRUPTION
|
#ifdef LOKI_CHECK_FOR_CORRUPTION
|
||||||
if ( foundChunk->IsCorrupt( numBlocks_, blockSize_, true ) )
|
if ( foundChunk->IsCorrupt( numBlocks_, blockSize_, true ) )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue