diff options
-rw-r--r-- | include/tools/unqidx.hxx | 3 | ||||
-rw-r--r-- | tools/source/memtools/unqidx.cxx | 6 |
2 files changed, 2 insertions, 7 deletions
diff --git a/include/tools/unqidx.hxx b/include/tools/unqidx.hxx index 190b8e10e212..b6d65b4db3ec 100644 --- a/include/tools/unqidx.hxx +++ b/include/tools/unqidx.hxx @@ -33,12 +33,11 @@ private: std::map<Index, void*> maMap; const Index nStartIndex; Index nUniqIndex; - Index nCount; public: UniqueIndexImpl( Index _nStartIndex = 0 ) : maMap(), - nStartIndex(_nStartIndex), nUniqIndex(_nStartIndex), nCount(0) {} + nStartIndex(_nStartIndex), nUniqIndex(_nStartIndex) {} Index Insert( void* p ); // insert value with key, replacing existing entry if necessary 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; } } |