binaryurp/source/cache.hxx | 58 ++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 29 deletions(-)
New commits: commit 11311b9216b61c7c7baa1d223726520fe2ad2264 Author: Stephan Bergmann <sberg...@redhat.com> Date: Thu Sep 25 11:49:23 2014 +0200 untabify Change-Id: Iad53e9cea28c3c7f3a8a2eaa1186d1e1be72affc diff --git a/binaryurp/source/cache.hxx b/binaryurp/source/cache.hxx index a580c5e..7cbb303 100644 --- a/binaryurp/source/cache.hxx +++ b/binaryurp/source/cache.hxx @@ -49,35 +49,35 @@ public: } IdxType add( const T& rContent, bool* pbFound) { - assert( pbFound != NULL); - if( !size_) { - *pbFound = false; - return cache::ignore; - } - // try to insert into the map - list_.push_front( rContent); // create a temp entry - typedef std::pair<typename LruList::iterator, IdxType> MappedType; - typedef std::pair<typename LruItMap::iterator,bool> MapPair; - MapPair aMP = map_.insert( MappedType( list_.begin(), 0)); - *pbFound = !aMP.second; - - if( !aMP.second) { // insertion not needed => found the entry - list_.pop_front(); // remove the temp entry - list_.splice( list_.begin(), list_, aMP.first->first); // the found entry is moved to front - return aMP.first->second; - } - - // test insertion successful => it was new so we keep it - IdxType n = static_cast<IdxType>( map_.size() - 1); - if( n >= size_) { // cache full => replace the LRU entry - // find the least recently used element in the map - typename LruItMap::iterator it = map_.find( --list_.end()); - n = it->second; - map_.erase( it); // remove it from the map - list_.pop_back(); // remove from the list - } - aMP.first->second = n; - return n; + assert( pbFound != NULL); + if( !size_) { + *pbFound = false; + return cache::ignore; + } + // try to insert into the map + list_.push_front( rContent); // create a temp entry + typedef std::pair<typename LruList::iterator, IdxType> MappedType; + typedef std::pair<typename LruItMap::iterator,bool> MapPair; + MapPair aMP = map_.insert( MappedType( list_.begin(), 0)); + *pbFound = !aMP.second; + + if( !aMP.second) { // insertion not needed => found the entry + list_.pop_front(); // remove the temp entry + list_.splice( list_.begin(), list_, aMP.first->first); // the found entry is moved to front + return aMP.first->second; + } + + // test insertion successful => it was new so we keep it + IdxType n = static_cast<IdxType>( map_.size() - 1); + if( n >= size_) { // cache full => replace the LRU entry + // find the least recently used element in the map + typename LruItMap::iterator it = map_.find( --list_.end()); + n = it->second; + map_.erase( it); // remove it from the map + list_.pop_back(); // remove from the list + } + aMP.first->second = n; + return n; } private: _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits