From c928983340029f95227882d340b0be0d4ca343e9 Mon Sep 17 00:00:00 2001 From: John Spray Date: Mon, 16 Apr 2018 09:13:10 -0400 Subject: [PATCH] mgr: fix up a couple of double-lookups Signed-off-by: John Spray --- src/mgr/ActivePyModules.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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; -- 2.39.5