summaryrefslogtreecommitdiff
path: root/binaryurp
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-09-25 11:49:23 +0200
committerStephan Bergmann <sbergman@redhat.com>2014-09-25 11:49:59 +0200
commit11311b9216b61c7c7baa1d223726520fe2ad2264 (patch)
treee50720b01854e9e7b2baf4773718e9f6af9b1803 /binaryurp
parentc35db5ca9d82554149d6a63e159c2da6037fa867 (diff)
untabify
Change-Id: Iad53e9cea28c3c7f3a8a2eaa1186d1e1be72affc
Diffstat (limited to 'binaryurp')
-rw-r--r--binaryurp/source/cache.hxx58
1 files changed, 29 insertions, 29 deletions
diff --git a/binaryurp/source/cache.hxx b/binaryurp/source/cache.hxx
index a580c5e78eb7..7cbb30392a97 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: