From f6771f2004d55442896a3635bce96b29fc1225a5 Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Thu, 30 Jan 2014 13:47:22 -0800 Subject: [PATCH] shared_cache: use a single lookup for lookup() too We didn't convert this one to use iterators before. Signed-off-by: Greg Farnum --- src/common/shared_cache.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/common/shared_cache.hpp b/src/common/shared_cache.hpp index df52178607d..2f5f05a0d64 100644 --- a/src/common/shared_cache.hpp +++ b/src/common/shared_cache.hpp @@ -153,8 +153,9 @@ public: bool retry = false; do { retry = false; - if (weak_refs.count(key)) { - val = weak_refs[key].lock(); + typename map::iterator i = weak_refs.find(key); + if (i != weak_refs.end()) { + val = i->second.lock(); if (val) { lru_add(key, val, &to_release); } else {