]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: cleanup with unique_ptr 16390/head
authorPatrick Donnelly <pdonnell@redhat.com>
Tue, 18 Jul 2017 23:39:09 +0000 (16:39 -0700)
committerPatrick Donnelly <pdonnell@redhat.com>
Wed, 19 Jul 2017 14:33:44 +0000 (07:33 -0700)
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
src/mds/MDSDaemon.cc

index 6ec8ab471b1369e6ceb9d49df61a377ff46e1363..6947cd2b63e20569c511f8eac0f2f01227236383 100644 (file)
 #include <unistd.h>
 
 #include "include/compat.h"
-#include "global/signal_handler.h"
-
 #include "include/types.h"
 #include "include/str_list.h"
-#include "common/entity_name.h"
+
 #include "common/Clock.h"
-#include "common/signal.h"
+#include "common/HeartbeatMap.h"
+#include "common/Timer.h"
+#include "common/backport14.h"
 #include "common/ceph_argparse.h"
+#include "common/config.h"
+#include "common/entity_name.h"
 #include "common/errno.h"
+#include "common/perf_counters.h"
+#include "common/signal.h"
 #include "common/version.h"
 
+#include "global/signal_handler.h"
+
 #include "msg/Messenger.h"
 #include "mon/MonClient.h"
 
 #include "SnapServer.h"
 #include "SnapClient.h"
 
-#include "common/HeartbeatMap.h"
-
-#include "common/perf_counters.h"
-
-#include "common/Timer.h"
-
 #include "events/ESession.h"
 #include "events/ESubtreeMap.h"
 
@@ -61,8 +61,6 @@
 #include "auth/RotatingKeyRing.h"
 #include "auth/KeyRing.h"
 
-#include "common/config.h"
-
 #include "perfglue/cpu_profiler.h"
 #include "perfglue/heap_profiler.h"
 
@@ -730,33 +728,31 @@ int MDSDaemon::_handle_command(
   std::stringstream ss;
   std::string prefix;
   std::string format;
-  boost::scoped_ptr<Formatter> f;
+  std::unique_ptr<Formatter> f(Formatter::create(format));
   cmd_getval(cct, cmdmap, "prefix", prefix);
 
   int r = 0;
 
   if (prefix == "get_command_descriptions") {
     int cmdnum = 0;
-    JSONFormatter *f = new JSONFormatter();
+    std::unique_ptr<JSONFormatter> f(ceph::make_unique<JSONFormatter>());
     f->open_object_section("command_descriptions");
     for (MDSCommand *cp = mds_commands;
         cp < &mds_commands[ARRAY_SIZE(mds_commands)]; cp++) {
 
       ostringstream secname;
       secname << "cmd" << setfill('0') << std::setw(3) << cmdnum;
-      dump_cmddesc_to_json(f, secname.str(), cp->cmdstring, cp->helpstring,
+      dump_cmddesc_to_json(f.get(), secname.str(), cp->cmdstring, cp->helpstring,
                           cp->module, cp->perm, cp->availability, 0);
       cmdnum++;
     }
     f->close_section();        // command_descriptions
 
     f->flush(ds);
-    delete f;
     goto out; 
   }
-  
+
   cmd_getval(cct, cmdmap, "format", format);
-  f.reset(Formatter::create(format));
   if (prefix == "version") {
     if (f) {
       f->open_object_section("version");