From: John Spray Date: Mon, 16 Apr 2018 13:13:10 +0000 (-0400) Subject: mgr: fix up a couple of double-lookups X-Git-Tag: v13.1.0~143^2~6 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=c928983340029f95227882d340b0be0d4ca343e9;p=ceph.git mgr: fix up a couple of double-lookups Signed-off-by: John Spray --- diff --git a/src/mgr/ActivePyModules.cc b/src/mgr/ActivePyModules.cc index 6df6cacffb6ec..9bb48e9f889d0 100644 --- a/src/mgr/ActivePyModules.cc +++ b/src/mgr/ActivePyModules.cc @@ -432,8 +432,9 @@ bool ActivePyModules::get_store(const std::string &module_name, dout(4) << __func__ << " key: " << global_key << dendl; - if (store_cache.count(global_key)) { - *val = store_cache.at(global_key); + auto i = store_cache.find(global_key); + if (i != store_cache.end()) { + *val = i->second; return true; } else { return false; @@ -454,8 +455,9 @@ bool ActivePyModules::get_config(const std::string &module_name, Mutex::Locker lock(module_config.lock); - if (module_config.config.count(global_key)) { - *val = module_config.config.at(global_key); + auto i = module_config.config.find(global_key); + if (i != module_config.config.end()) { + *val = i->second; return true; } else { return false;