diff options
Diffstat (limited to 'stoc/source/corereflection/lrucache.hxx')
-rw-r--r-- | stoc/source/corereflection/lrucache.hxx | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/stoc/source/corereflection/lrucache.hxx b/stoc/source/corereflection/lrucache.hxx index e9a89bebd66f..b52a05fe1213 100644 --- a/stoc/source/corereflection/lrucache.hxx +++ b/stoc/source/corereflection/lrucache.hxx @@ -90,16 +90,13 @@ inline LRU_Cache< t_Key, t_Val, t_KeyHash >::LRU_Cache() , _pHead( nullptr ) , _pTail( nullptr ) { - if (_nCachedElements > 0) + _pBlock.reset(new CacheEntry[_nCachedElements]); + _pHead = _pBlock.get(); + _pTail = _pBlock.get() + _nCachedElements - 1; + for (sal_Int32 nPos = _nCachedElements; nPos--;) { - _pBlock.reset(new CacheEntry[_nCachedElements]); - _pHead = _pBlock.get(); - _pTail = _pBlock.get() + _nCachedElements -1; - for ( sal_Int32 nPos = _nCachedElements; nPos--; ) - { - _pBlock[nPos].pPred = _pBlock.get() + nPos -1; - _pBlock[nPos].pSucc = _pBlock.get() + nPos +1; - } + _pBlock[nPos].pPred = _pBlock.get() + nPos - 1; + _pBlock[nPos].pSucc = _pBlock.get() + nPos + 1; } } |