Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Cosmetics: use empty parentheses for new std::container.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 23 Dec 2019 13:39:27 +0000 (14:39 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 23 Dec 2019 13:48:46 +0000 (14:48 +0100)
src/instr/instr_platform.cpp
src/simdag/sd_dotloader.cpp
src/smpi/bindings/smpi_pmpi_coll.cpp
src/smpi/bindings/smpi_pmpi_request.cpp
src/smpi/mpi/smpi_f2c.cpp
src/surf/sg_platf.cpp
src/surf/surf_interface.cpp

index f0dd78a..ef07fe1 100644 (file)
@@ -138,8 +138,8 @@ static void recursiveGraphExtraction(simgrid::s4u::NetZone* netzone, container_t
   }
 
   xbt_graph_t graph                        = xbt_graph_new_graph(0, nullptr);
   }
 
   xbt_graph_t graph                        = xbt_graph_new_graph(0, nullptr);
-  std::map<std::string, xbt_node_t>* nodes = new std::map<std::string, xbt_node_t>;
-  std::map<std::string, xbt_edge_t>* edges = new std::map<std::string, xbt_edge_t>;
+  std::map<std::string, xbt_node_t>* nodes = new std::map<std::string, xbt_node_t>();
+  std::map<std::string, xbt_edge_t>* edges = new std::map<std::string, xbt_edge_t>();
 
   netzone->get_impl()->get_graph(graph, nodes, edges);
   for (auto elm : *edges) {
 
   netzone->get_impl()->get_graph(graph, nodes, edges);
   for (auto elm : *edges) {
@@ -278,7 +278,7 @@ static void instr_netpoint_on_creation(simgrid::kernel::routing::NetPoint const&
 static void instr_on_platform_created()
 {
   currentContainer.clear();
 static void instr_on_platform_created()
 {
   currentContainer.clear();
-  std::set<std::string>* filter = new std::set<std::string>;
+  std::set<std::string>* filter = new std::set<std::string>();
   XBT_DEBUG("Starting graph extraction.");
   recursiveGraphExtraction(simgrid::s4u::Engine::get_instance()->get_netzone_root(),
                            simgrid::instr::Container::get_root(), filter);
   XBT_DEBUG("Starting graph extraction.");
   recursiveGraphExtraction(simgrid::s4u::Engine::get_instance()->get_netzone_root(),
                            simgrid::instr::Container::get_root(), filter);
@@ -508,8 +508,8 @@ static void recursiveXBTGraphExtraction(xbt_graph_t graph, std::map<std::string,
 xbt_graph_t instr_routing_platform_graph()
 {
   xbt_graph_t ret                          = xbt_graph_new_graph(0, nullptr);
 xbt_graph_t instr_routing_platform_graph()
 {
   xbt_graph_t ret                          = xbt_graph_new_graph(0, nullptr);
-  std::map<std::string, xbt_node_t>* nodes = new std::map<std::string, xbt_node_t>;
-  std::map<std::string, xbt_edge_t>* edges = new std::map<std::string, xbt_edge_t>;
+  std::map<std::string, xbt_node_t>* nodes = new std::map<std::string, xbt_node_t>();
+  std::map<std::string, xbt_edge_t>* edges = new std::map<std::string, xbt_edge_t>();
   recursiveXBTGraphExtraction(ret, nodes, edges, simgrid::s4u::Engine::get_instance()->get_netzone_root(),
                               simgrid::instr::Container::get_root());
   delete nodes;
   recursiveXBTGraphExtraction(ret, nodes, edges, simgrid::s4u::Engine::get_instance()->get_netzone_root(),
                               simgrid::instr::Container::get_root());
   delete nodes;
index 90d8662..bfd0ddb 100644 (file)
@@ -99,7 +99,7 @@ xbt_dynar_t SD_dotload_generic(const char* filename, bool sequential, bool sched
           if (comp != computers.end()) {
             computer = comp->second;
           } else {
           if (comp != computers.end()) {
             computer = comp->second;
           } else {
-            computer = new std::vector<SD_task_t>;
+            computer = new std::vector<SD_task_t>();
             computers.insert({char_performer, computer});
           }
           if (static_cast<unsigned int>(order) < computer->size()) {
             computers.insert({char_performer, computer});
           }
           if (static_cast<unsigned int>(order) < computer->size()) {
index 0a97fa0..dd38bb4 100644 (file)
@@ -176,7 +176,7 @@ int PMPI_Igatherv(const void* sendbuf, int sendcount, MPI_Datatype sendtype, voi
   int rank         = simgrid::s4u::this_actor::get_pid();
   int dt_size_recv = recvtype->is_replayable() ? 1 : recvtype->size();
 
   int rank         = simgrid::s4u::this_actor::get_pid();
   int dt_size_recv = recvtype->is_replayable() ? 1 : recvtype->size();
 
-  std::vector<int>* trace_recvcounts = new std::vector<int>;
+  std::vector<int>* trace_recvcounts = new std::vector<int>();
   if (comm->rank() == root) {
     for (int i = 0; i < comm->size(); i++) // copy data to avoid bad free
       trace_recvcounts->push_back(recvcounts[i] * dt_size_recv);
   if (comm->rank() == root) {
     for (int i = 0; i < comm->size(); i++) // copy data to avoid bad free
       trace_recvcounts->push_back(recvcounts[i] * dt_size_recv);
@@ -275,7 +275,7 @@ int PMPI_Iallgatherv(const void* sendbuf, int sendcount, MPI_Datatype sendtype,
   int rank         = simgrid::s4u::this_actor::get_pid();
   int dt_size_recv = recvtype->is_replayable() ? 1 : recvtype->size();
 
   int rank         = simgrid::s4u::this_actor::get_pid();
   int dt_size_recv = recvtype->is_replayable() ? 1 : recvtype->size();
 
-  std::vector<int>* trace_recvcounts = new std::vector<int>;
+  std::vector<int>* trace_recvcounts = new std::vector<int>();
   for (int i = 0; i < comm->size(); i++) { // copy data to avoid bad free
     trace_recvcounts->push_back(recvcounts[i] * dt_size_recv);
   }
   for (int i = 0; i < comm->size(); i++) { // copy data to avoid bad free
     trace_recvcounts->push_back(recvcounts[i] * dt_size_recv);
   }
@@ -377,7 +377,7 @@ int PMPI_Iscatterv(const void* sendbuf, const int* sendcounts, const int* displs
   int rank         = simgrid::s4u::this_actor::get_pid();
   int dt_size_send = sendtype->is_replayable() ? 1 : sendtype->size();
 
   int rank         = simgrid::s4u::this_actor::get_pid();
   int dt_size_send = sendtype->is_replayable() ? 1 : sendtype->size();
 
-  std::vector<int>* trace_sendcounts = new std::vector<int>;
+  std::vector<int>* trace_sendcounts = new std::vector<int>();
   if (comm->rank() == root) {
     for (int i = 0; i < comm->size(); i++) { // copy data to avoid bad free
       trace_sendcounts->push_back(sendcounts[i] * dt_size_send);
   if (comm->rank() == root) {
     for (int i = 0; i < comm->size(); i++) { // copy data to avoid bad free
       trace_sendcounts->push_back(sendcounts[i] * dt_size_send);
@@ -576,7 +576,7 @@ int PMPI_Ireduce_scatter(const void *sendbuf, void *recvbuf, const int *recvcoun
 
   smpi_bench_end();
   int rank                           = simgrid::s4u::this_actor::get_pid();
 
   smpi_bench_end();
   int rank                           = simgrid::s4u::this_actor::get_pid();
-  std::vector<int>* trace_recvcounts = new std::vector<int>;
+  std::vector<int>* trace_recvcounts = new std::vector<int>();
   int dt_send_size                   = datatype->is_replayable() ? 1 : datatype->size();
   int totalcount                     = 0;
 
   int dt_send_size                   = datatype->is_replayable() ? 1 : datatype->size();
   int totalcount                     = 0;
 
@@ -733,8 +733,8 @@ int PMPI_Ialltoallv(const void* sendbuf, const int* sendcounts, const int* sendd
   smpi_bench_end();
   int send_size                      = 0;
   int recv_size                      = 0;
   smpi_bench_end();
   int send_size                      = 0;
   int recv_size                      = 0;
-  std::vector<int>* trace_sendcounts = new std::vector<int>;
-  std::vector<int>* trace_recvcounts = new std::vector<int>;
+  std::vector<int>* trace_sendcounts = new std::vector<int>();
+  std::vector<int>* trace_recvcounts = new std::vector<int>();
   int dt_size_recv                   = recvtype->size();
 
   const int* real_sendcounts = sendcounts;
   int dt_size_recv                   = recvtype->size();
 
   const int* real_sendcounts = sendcounts;
@@ -824,8 +824,8 @@ int PMPI_Ialltoallw(const void* sendbuf, const int* sendcounts, const int* sendd
 
   int send_size                      = 0;
   int recv_size                      = 0;
 
   int send_size                      = 0;
   int recv_size                      = 0;
-  std::vector<int>* trace_sendcounts = new std::vector<int>;
-  std::vector<int>* trace_recvcounts = new std::vector<int>;
+  std::vector<int>* trace_sendcounts = new std::vector<int>();
+  std::vector<int>* trace_recvcounts = new std::vector<int>();
 
   const int* real_sendcounts         = sendcounts;
   const int* real_senddispls          = senddispls;
 
   const int* real_sendcounts         = sendcounts;
   const int* real_senddispls          = senddispls;
index 88a4c98..dc9f48e 100644 (file)
@@ -427,8 +427,8 @@ int PMPI_Sendrecv(const void* sendbuf, int sendcount, MPI_Datatype sendtype, int
     int src_traced         = getPid(comm, src);
 
     // FIXME: Hack the way to trace this one
     int src_traced         = getPid(comm, src);
 
     // FIXME: Hack the way to trace this one
-    std::vector<int>* dst_hack = new std::vector<int>;
-    std::vector<int>* src_hack = new std::vector<int>;
+    std::vector<int>* dst_hack = new std::vector<int>();
+    std::vector<int>* src_hack = new std::vector<int>();
     dst_hack->push_back(dst_traced);
     src_hack->push_back(src_traced);
     TRACE_smpi_comm_in(my_proc_id, __func__,
     dst_hack->push_back(dst_traced);
     src_hack->push_back(src_traced);
     TRACE_smpi_comm_in(my_proc_id, __func__,
index 0c0cab3..bb8e9cf 100644 (file)
@@ -66,7 +66,7 @@ void F2C::free_f(int id)
 int F2C::add_f()
 {
   if (f2c_lookup_ == nullptr)
 int F2C::add_f()
 {
   if (f2c_lookup_ == nullptr)
-    f2c_lookup_ = new std::unordered_map<std::string, F2C*>;
+    f2c_lookup_ = new std::unordered_map<std::string, F2C*>();
 
   char key[KEY_SIZE];
   my_f2c_id_=f2c_id_;
 
   char key[KEY_SIZE];
   my_f2c_id_=f2c_id_;
@@ -78,7 +78,7 @@ int F2C::add_f()
 int F2C::c2f()
 {
   if (f2c_lookup_ == nullptr) {
 int F2C::c2f()
 {
   if (f2c_lookup_ == nullptr) {
-    f2c_lookup_ = new std::unordered_map<std::string, F2C*>;
+    f2c_lookup_ = new std::unordered_map<std::string, F2C*>();
   }
 
   if(my_f2c_id_==-1)
   }
 
   if(my_f2c_id_==-1)
@@ -91,7 +91,7 @@ int F2C::c2f()
 F2C* F2C::f2c(int id)
 {
   if (f2c_lookup_ == nullptr)
 F2C* F2C::f2c(int id)
 {
   if (f2c_lookup_ == nullptr)
-    f2c_lookup_ = new std::unordered_map<std::string, F2C*>;
+    f2c_lookup_ = new std::unordered_map<std::string, F2C*>();
 
   if(id >= 0){
     char key[KEY_SIZE];
 
   if(id >= 0){
     char key[KEY_SIZE];
index 98b7b87..c4f452e 100644 (file)
@@ -196,7 +196,7 @@ void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster
     simgrid::kernel::routing::HostCreationArgs host;
     host.id = host_id;
     if ((cluster->properties != nullptr) && (not cluster->properties->empty())) {
     simgrid::kernel::routing::HostCreationArgs host;
     host.id = host_id;
     if ((cluster->properties != nullptr) && (not cluster->properties->empty())) {
-      host.properties = new std::unordered_map<std::string, std::string>;
+      host.properties = new std::unordered_map<std::string, std::string>();
 
       for (auto const& elm : *cluster->properties)
         host.properties->insert({elm.first, elm.second});
 
       for (auto const& elm : *cluster->properties)
         host.properties->insert({elm.first, elm.second});
index 05ea270..134ba2d 100644 (file)
@@ -48,7 +48,7 @@ static void XBT_ATTRIB_DESTRUCTOR(800) simgrid_free_plugin_description()
 XBT_PUBLIC void simgrid_add_plugin_description(const char* name, const char* description, void_f_void_t init_fun)
 {
   if (not surf_plugin_description)
 XBT_PUBLIC void simgrid_add_plugin_description(const char* name, const char* description, void_f_void_t init_fun)
 {
   if (not surf_plugin_description)
-    surf_plugin_description = new std::vector<surf_model_description_t>;
+    surf_plugin_description = new std::vector<surf_model_description_t>();
   surf_plugin_description->emplace_back(surf_model_description_t{name, description, init_fun});
 }
 
   surf_plugin_description->emplace_back(surf_model_description_t{name, description, init_fun});
 }