From 538c649f799c8c03218654588e6fd37162a151a1 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 27 Jun 2017 18:02:32 +0200 Subject: [PATCH] -Werror=shadow (GCC 8) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit > include/o3tl/lru_map.hxx:70:24: error: declaration of ‘iterator’ shadows a previous local [-Werror=shadow] > map_iterator_t iterator = mLruMap.find(rPair.first); > ^~~~~~~~ > include/o3tl/lru_map.hxx:61:29: note: shadowed declaration is here > typedef list_iterator_t iterator; > ^~~~~~~~ Change-Id: Ic0f8ab4609a06b713ffa6e8e9fdd04f0c42869d7 --- include/o3tl/lru_map.hxx | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/include/o3tl/lru_map.hxx b/include/o3tl/lru_map.hxx index c1bfff733f5b..2f41521795fc 100644 --- a/include/o3tl/lru_map.hxx +++ b/include/o3tl/lru_map.hxx @@ -67,9 +67,9 @@ public: void insert(key_value_pair_t& rPair) { - map_iterator_t iterator = mLruMap.find(rPair.first); + map_iterator_t i = mLruMap.find(rPair.first); - if (iterator == mLruMap.end()) // doesn't exist -> add to queue and map + if (i == mLruMap.end()) // doesn't exist -> add to queue and map { // add to front of the list mLruList.push_front(rPair); @@ -80,17 +80,17 @@ public: else // already exists -> replace value { // replace value - iterator->second->second = rPair.second; + i->second->second = rPair.second; // bring to front of the lru list - mLruList.splice(mLruList.begin(), mLruList, iterator->second); + mLruList.splice(mLruList.begin(), mLruList, i->second); } } void insert(key_value_pair_t&& rPair) { - map_iterator_t iterator = mLruMap.find(rPair.first); + map_iterator_t i = mLruMap.find(rPair.first); - if (iterator == mLruMap.end()) // doesn't exist -> add to list and map + if (i == mLruMap.end()) // doesn't exist -> add to list and map { // add to front of the list mLruList.push_front(std::move(rPair)); @@ -101,16 +101,16 @@ public: else // already exists -> replace value { // replace value - iterator->second->second = std::move(rPair.second); + i->second->second = std::move(rPair.second); // push to back of the lru list - mLruList.splice(mLruList.begin(), mLruList, iterator->second); + mLruList.splice(mLruList.begin(), mLruList, i->second); } } const list_const_iterator_t find(const Key& key) { - const map_iterator_t iterator = mLruMap.find(key); - if (iterator == mLruMap.cend()) // can't find entry for the key + const map_iterator_t i = mLruMap.find(key); + if (i == mLruMap.cend()) // can't find entry for the key { // return empty iterator return mLruList.cend(); @@ -118,8 +118,8 @@ public: else { // push to back of the lru list - mLruList.splice(mLruList.begin(), mLruList, iterator->second); - return iterator->second; + mLruList.splice(mLruList.begin(), mLruList, i->second); + return i->second; } }