VOM: favour make_shared 83/9583/2
authorNeale Ranns <neale.ranns@cisco.com>
Mon, 27 Nov 2017 12:52:35 +0000 (04:52 -0800)
committerNeale Ranns <nranns@cisco.com>
Mon, 27 Nov 2017 15:55:40 +0000 (15:55 +0000)
Change-Id: I0c5e198049d510f3b3f9a6aefe49c315449768e3
Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
13 files changed:
src/vpp-api/vom/acl_binding.cpp
src/vpp-api/vom/acl_binding_cmds.hpp
src/vpp-api/vom/acl_list.cpp
src/vpp-api/vom/bridge_domain.cpp
src/vpp-api/vom/bridge_domain_entry.cpp
src/vpp-api/vom/dump_cmd.hpp
src/vpp-api/vom/interface.cpp
src/vpp-api/vom/interface_span.cpp
src/vpp-api/vom/l2_binding.cpp
src/vpp-api/vom/l3_binding.cpp
src/vpp-api/vom/route.cpp
src/vpp-api/vom/tap_interface.cpp
src/vpp-api/vom/vxlan_tunnel.cpp

index 267b02a..b87cfba 100644 (file)
@@ -23,10 +23,10 @@ void
 l2_binding::event_handler::handle_populate(const client_db::key_t& key)
 {
   /*
-* dump VPP Bridge domains
-*/
-  std::shared_ptr<binding_cmds::l2_dump_cmd> cmd(
-    new binding_cmds::l2_dump_cmd());
+   * dump VPP Bridge domains
+   */
+  std::shared_ptr<binding_cmds::l2_dump_cmd> cmd =
+    std::make_shared<binding_cmds::l2_dump_cmd>();
 
   HW::enqueue(cmd);
   HW::write();
@@ -50,8 +50,8 @@ template <>
 void
 l3_binding::event_handler::handle_populate(const client_db::key_t& key)
 {
-  std::shared_ptr<binding_cmds::l3_dump_cmd> cmd(
-    new binding_cmds::l3_dump_cmd());
+  std::shared_ptr<binding_cmds::l3_dump_cmd> cmd =
+    std::make_shared<binding_cmds::l3_dump_cmd>();
 
   HW::enqueue(cmd);
   HW::write();
index 0bc698b..4e8895a 100644 (file)
@@ -162,7 +162,6 @@ public:
    * Constructor
    */
   dump_cmd() = default;
-  dump_cmd(const dump_cmd& d) = default;
 
   /**
    * Issue the command to VPP/HW
index 0c92c02..9733278 100644 (file)
@@ -27,9 +27,10 @@ l2_list::event_handler::handle_populate(const client_db::key_t& key)
   m_evh.order();
 
   /*
-* dump VPP Bridge domains
-*/
-  std::shared_ptr<list_cmds::l2_dump_cmd> cmd(new list_cmds::l2_dump_cmd());
+   * dump VPP Bridge domains
+   */
+  std::shared_ptr<list_cmds::l2_dump_cmd> cmd =
+    std::make_shared<list_cmds::l2_dump_cmd>();
 
   HW::enqueue(cmd);
   HW::write();
@@ -52,10 +53,10 @@ l2_list::event_handler::handle_populate(const client_db::key_t& key)
     VOM_LOG(log_level_t::DEBUG) << "dump: " << acl.to_string();
 
     /*
-* Write each of the discovered ACLs into the OM,
-* but disable the HW Command q whilst we do, so that no
-* commands are sent to VPP
-*/
+     * Write each of the discovered ACLs into the OM,
+     * but disable the HW Command q whilst we do, so that no
+     * commands are sent to VPP
+     */
     OM::commit(key, acl);
   }
 }
@@ -68,9 +69,10 @@ l3_list::event_handler::handle_populate(const client_db::key_t& key)
   m_evh.order();
 
   /*
-* dump VPP Bridge domains
-*/
-  std::shared_ptr<list_cmds::l3_dump_cmd> cmd(new list_cmds::l3_dump_cmd());
+   * dump L3 ACLs Bridge domains
+   */
+  std::shared_ptr<list_cmds::l3_dump_cmd> cmd =
+    std::make_shared<list_cmds::l3_dump_cmd>();
 
   HW::enqueue(cmd);
   HW::write();
@@ -95,10 +97,10 @@ l3_list::event_handler::handle_populate(const client_db::key_t& key)
     VOM_LOG(log_level_t::DEBUG) << "dump: " << acl.to_string();
 
     /*
-* Write each of the discovered ACLs into the OM,
-* but disable the HW Command q whilst we do, so that no
-* commands are sent to VPP
-*/
+     * Write each of the discovered ACLs into the OM,
+     * but disable the HW Command q whilst we do, so that no
+     * commands are sent to VPP
+     */
     OM::commit(key, acl);
   }
 }
index 6826819..583e35d 100644 (file)
@@ -143,10 +143,10 @@ void
 bridge_domain::event_handler::handle_populate(const client_db::key_t& key)
 {
   /*
- * dump VPP Bridge domains
- */
-  std::shared_ptr<bridge_domain_cmds::dump_cmd> cmd(
-    new bridge_domain_cmds::dump_cmd());
  * dump VPP Bridge domains
  */
+  std::shared_ptr<bridge_domain_cmds::dump_cmd> cmd =
+    std::make_shared<bridge_domain_cmds::dump_cmd>();
 
   HW::enqueue(cmd);
   HW::write();
index 79f36f7..de1c4b7 100644 (file)
@@ -155,8 +155,8 @@ bridge_domain_entry::event_handler::handle_replay()
 void
 bridge_domain_entry::event_handler::handle_populate(const client_db::key_t& key)
 {
-  std::shared_ptr<bridge_domain_entry_cmds::dump_cmd> cmd(
-    new bridge_domain_entry_cmds::dump_cmd());
+  std::shared_ptr<bridge_domain_entry_cmds::dump_cmd> cmd =
+    std::make_shared<bridge_domain_entry_cmds::dump_cmd>();
 
   HW::enqueue(cmd);
   HW::write();
index 72fcdf5..4dad02b 100644 (file)
@@ -62,6 +62,8 @@ public:
    */
   virtual ~dump_cmd() {}
 
+  dump_cmd(const dump_cmd& d) = default;
+
   /**
    * Constant iterator to the start of the records retunred during the dump
    */
index aab2eab..c7b7e43 100644 (file)
@@ -435,7 +435,8 @@ interface::event_handler::handle_populate(const client_db::key_t& key)
   /*
    * dump VPP current states
    */
-  interface_cmds::dump_cmd* cmd = new interface_cmds::dump_cmd();
+  std::shared_ptr<interface_cmds::dump_cmd> cmd =
+    std::make_shared<interface_cmds::dump_cmd>();
 
   HW::enqueue(cmd);
   HW::write();
index 5bdbda9..9243f2d 100644 (file)
@@ -132,8 +132,8 @@ interface_span::event_handler::handle_replay()
 void
 interface_span::event_handler::handle_populate(const client_db::key_t& key)
 {
-  std::shared_ptr<interface_span_cmds::dump_cmd> cmd(
-    new interface_span_cmds::dump_cmd());
+  std::shared_ptr<interface_span_cmds::dump_cmd> cmd =
+    std::make_shared<interface_span_cmds::dump_cmd>();
 
   HW::enqueue(cmd);
   HW::write();
index dd49e57..cc0e84a 100644 (file)
@@ -203,8 +203,8 @@ void
 l2_binding::event_handler::handle_populate(const client_db::key_t& key)
 {
   /**
- * This is done while populating the bridge-domain
- */
  * This is done while populating the bridge-domain
  */
 }
 
 dependency_t
index be7c9d1..6ff8244 100644 (file)
@@ -171,9 +171,9 @@ l3_binding::find(const interface& i)
 
   while (it != m_db.cend()) {
     /*
- * The key in the DB is a pair of the interface's name and prefix.
- * If the keys match, save the L3-config
- */
    * The key in the DB is a pair of the interface's name and prefix.
    * If the keys match, save the L3-config
    */
     auto key = it->first;
 
     if (i.key() == key.first) {
@@ -202,8 +202,8 @@ void
 l3_binding::event_handler::handle_populate(const client_db::key_t& key)
 {
   /**
- * This is done while populating the interfaces
- */
  * This is done while populating the interfaces
  */
 }
 
 dependency_t
index 0da2ebb..661d99c 100644 (file)
@@ -360,10 +360,10 @@ ip_route::event_handler::handle_replay()
 void
 ip_route::event_handler::handle_populate(const client_db::key_t& key)
 {
-  std::shared_ptr<ip_route_cmds::dump_v4_cmd> cmd_v4(
-    new ip_route_cmds::dump_v4_cmd());
-  std::shared_ptr<ip_route_cmds::dump_v6_cmd> cmd_v6(
-    new ip_route_cmds::dump_v6_cmd());
+  std::shared_ptr<ip_route_cmds::dump_v4_cmd> cmd_v4 =
+    std::make_shared<ip_route_cmds::dump_v4_cmd>();
+  std::shared_ptr<ip_route_cmds::dump_v6_cmd> cmd_v6 =
+    std::make_shared<ip_route_cmds::dump_v6_cmd>();
 
   HW::enqueue(cmd_v4);
   HW::enqueue(cmd_v6);
index 8314b40..4f88d3b 100644 (file)
@@ -101,8 +101,8 @@ tap_interface::event_handler::handle_populate(const client_db::key_t& key)
   /*
    * dump VPP current states
    */
-  std::shared_ptr<tap_interface_cmds::dump_cmd> cmd(
-    new tap_interface_cmds::dump_cmd());
+  std::shared_ptr<tap_interface_cmds::dump_cmd> cmd =
+    std::make_shared<tap_interface_cmds::dump_cmd>();
 
   HW::enqueue(cmd);
   HW::write();
index cf87223..8961589 100644 (file)
@@ -219,8 +219,8 @@ vxlan_tunnel::event_handler::handle_populate(const client_db::key_t& key)
   /*
    * dump VPP current states
    */
-  std::shared_ptr<vxlan_tunnel_cmds::dump_cmd> cmd(
-    new vxlan_tunnel_cmds::dump_cmd());
+  std::shared_ptr<vxlan_tunnel_cmds::dump_cmd> cmd =
+    std::make_shared<vxlan_tunnel_cmds::dump_cmd>();
 
   HW::enqueue(cmd);
   HW::write();