Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use C++ strings instead of char*.
[simgrid.git] / src / surf / sg_platf.cpp
index 219c193..6966739 100644 (file)
@@ -131,12 +131,11 @@ void sg_platf_new_link(LinkCreationArgs* link)
   }
   for (auto const& link_name : names) {
     simgrid::surf::LinkImpl* l =
-        surf_network_model->createLink(link_name.c_str(), link->bandwidth, link->latency, link->policy);
+        surf_network_model->createLink(link_name, link->bandwidth, link->latency, link->policy);
 
     if (link->properties) {
       for (auto const& elm : *link->properties)
         l->setProperty(elm.first, elm.second);
-      delete link->properties;
     }
 
     if (link->latency_trace)
@@ -146,6 +145,7 @@ void sg_platf_new_link(LinkCreationArgs* link)
     if (link->state_trace)
       l->setStateTrace(link->state_trace);
   }
+  delete link->properties;
 }
 
 void sg_platf_new_cluster(ClusterCreationArgs* cluster)
@@ -274,7 +274,7 @@ void sg_platf_new_cluster(ClusterCreationArgs* cluster)
   XBT_DEBUG("<router id=\"%s\"/>", cluster->router_id.c_str());
   if (cluster->router_id.empty()) {
     std::string newid   = std::string(cluster->prefix) + cluster->id + "_router" + cluster->suffix;
-    current_as->router_ = sg_platf_new_router(newid.c_str(), NULL);
+    current_as->router_ = sg_platf_new_router(newid, NULL);
   } else {
     current_as->router_ = sg_platf_new_router(cluster->router_id, NULL);
   }