]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/Mgr: have smaller lexical scope of local var 36937/head
authorKefu Chai <kchai@redhat.com>
Fri, 28 Aug 2020 05:59:27 +0000 (13:59 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 2 Sep 2020 03:54:33 +0000 (11:54 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/mgr/Mgr.cc

index 7115555c2a05c49c030b8e9a37ba5824439b0e7b..781017a26890292b3f7f03048782efd7d3c72538 100644 (file)
@@ -100,9 +100,8 @@ void MetadataUpdate::finish(int r)
         }
       }
 
-      DaemonStatePtr state;
       if (daemon_state.exists(key)) {
-        state = daemon_state.get(key);
+        DaemonStatePtr state = daemon_state.get(key);
         state->hostname = daemon_meta.at("hostname").get_str();
 
         if (key.type == "mds" || key.type == "mgr" || key.type == "mon") {
@@ -117,7 +116,7 @@ void MetadataUpdate::finish(int r)
        }
        daemon_state.update_metadata(state, m);
       } else {
-        state = std::make_shared<DaemonState>(daemon_state.types);
+        auto state = std::make_shared<DaemonState>(daemon_state.types);
         state->key = key;
         state->hostname = daemon_meta.at("hostname").get_str();