summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2016-03-05 09:48:11 +0100
committerMatteo Casalin <matteo.casalin@yahoo.com>2016-03-05 11:32:11 +0100
commitae35981823114d51376bf86bf1db665db62482c3 (patch)
treec9b62423ad0e6b8d6c68e8270a5241dce6d90abc /tools
parent9f7f577df3bc056c77d63aafa26e4d21c53af0aa (diff)
Do not duplicate count of items
Change-Id: I373b39f36fee7c37f2c10cc748f309412d68b688
Diffstat (limited to 'tools')
-rw-r--r--tools/source/memtools/unqidx.cxx6
1 files changed, 1 insertions, 5 deletions
diff --git a/tools/source/memtools/unqidx.cxx b/tools/source/memtools/unqidx.cxx
index ea3b773c6b79..7d7ac85314ac 100644
--- a/tools/source/memtools/unqidx.cxx
+++ b/tools/source/memtools/unqidx.cxx
@@ -26,9 +26,7 @@ UniqueIndexImpl::Index UniqueIndexImpl::Insert( void* p )
return IndexNotFound;
// Expend array if full
- Index nTmp = static_cast<Index>(maMap.size());
- if( nTmp == nCount )
- nTmp++;
+ const Index nTmp = static_cast<Index>(maMap.size()) + 1;
// Avoid overflow of UniqIndex upon deletion
nUniqIndex = nUniqIndex % nTmp;
@@ -40,7 +38,6 @@ UniqueIndexImpl::Index UniqueIndexImpl::Insert( void* p )
// Insert object to array
maMap[ nUniqIndex ] = p;
- nCount++;
nUniqIndex++;
return ( nUniqIndex + nStartIndex - 1 );
}
@@ -57,7 +54,6 @@ void* UniqueIndexImpl::Remove( Index nIndex )
{
void* p = it->second;
maMap.erase( it );
- nCount--;
return p;
}
}