]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: fix up a couple of double-lookups
authorJohn Spray <john.spray@redhat.com>
Mon, 16 Apr 2018 13:13:10 +0000 (09:13 -0400)
committerJohn Spray <john.spray@redhat.com>
Mon, 23 Apr 2018 11:29:47 +0000 (07:29 -0400)
Signed-off-by: John Spray <john.spray@redhat.com>
src/mgr/ActivePyModules.cc

index 6df6cacffb6ecdf1ed1c30e64f5e47440fa202b6..9bb48e9f889d0199647d10723536ce6d581a86fb 100644 (file)
@@ -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;