Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Avoid using memset to initialize structs.
[simgrid.git] / src / surf / sg_platf.cpp
index ad5d651..a853c3d 100644 (file)
@@ -194,8 +194,7 @@ void sg_platf_new_cluster(ClusterCreationArgs* cluster)
 
     XBT_DEBUG("<host\tid=\"%s\"\tpower=\"%f\">", host_id.c_str(), cluster->speeds.front());
 
-    s_sg_platf_host_cbarg_t host;
-    memset(&host, 0, sizeof(host));
+    s_sg_platf_host_cbarg_t host{};
     host.id = host_id.c_str();
     if ((cluster->properties != nullptr) && (not cluster->properties->empty())) {
       host.properties = new std::map<std::string, std::string>;
@@ -315,8 +314,7 @@ void sg_platf_new_cabinet(CabinetCreationArgs* cabinet)
 {
   for (int const& radical : *cabinet->radicals) {
     std::string hostname = cabinet->prefix + std::to_string(radical) + cabinet->suffix;
-    s_sg_platf_host_cbarg_t host;
-    memset(&host, 0, sizeof(host));
+    s_sg_platf_host_cbarg_t host{};
     host.pstate           = 0;
     host.core_amount      = 1;
     host.id               = hostname.c_str();
@@ -530,7 +528,7 @@ static void surf_config_models_setup()
   if ((not xbt_cfg_is_default_value("network/model") || not xbt_cfg_is_default_value("cpu/model")) &&
       xbt_cfg_is_default_value("host/model")) {
     host_model_name = "compound";
-    xbt_cfg_set_string("host/model", host_model_name);
+    xbt_cfg_set_string("host/model", host_model_name.c_str());
   }
 
   XBT_DEBUG("host model: %s", host_model_name.c_str());