summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorscr@chromium.org <scr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-21 17:49:07 +0000
committerscr@chromium.org <scr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-21 17:49:07 +0000
commit854a485212d5978beb5d58aa9dc122fc138ed2a1 (patch)
tree32e16657e5f774709ede989745cfc9226970ed24 /base
parent53b6b58a4dc24b57153c2154885cc36d6f369e9a (diff)
downloadchromium_src-854a485212d5978beb5d58aa9dc122fc138ed2a1.zip
chromium_src-854a485212d5978beb5d58aa9dc122fc138ed2a1.tar.gz
chromium_src-854a485212d5978beb5d58aa9dc122fc138ed2a1.tar.bz2
Coverity fixlet: fix PASS_BY_VALUE
R=jar@chromium.org CID=102145 BUG= TEST= Review URL: http://codereview.chromium.org/9006030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115350 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/memory/mru_cache.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/base/memory/mru_cache.h b/base/memory/mru_cache.h
index 29db3cf..a99f189 100644
--- a/base/memory/mru_cache.h
+++ b/base/memory/mru_cache.h
@@ -135,7 +135,7 @@ class MRUCacheBase {
// Erases the item referenced by the given iterator. An iterator to the item
// following it will be returned. The iterator must be valid.
- iterator Erase(iterator pos) {
+ iterator Erase(const iterator& pos) {
deletor_(pos->second);
index_.erase(pos->first);
return ordering_.erase(pos);
@@ -143,11 +143,12 @@ class MRUCacheBase {
// MRUCache entries are often processed in reverse order, so we add this
// convenience function (not typically defined by STL containers).
- reverse_iterator Erase(reverse_iterator pos) {
+ reverse_iterator Erase(const reverse_iterator& pos) {
// We have to actually give it the incremented iterator to delete, since
// the forward iterator that base() returns is actually one past the item
// being iterated over.
- return reverse_iterator(Erase((++pos).base()));
+ reverse_iterator next = pos;
+ return reverse_iterator(Erase((++next).base()));
}
// Shrinks the cache so it only holds |new_size| items. If |new_size| is