X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b4ac368a8512fa8ec30d04f55c4a3c660e9439b9..8164c2d758134b0e83cded911ddd43ce07dc8ead:/src/surf/sg_platf.cpp diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index d6f9e7de95..a853c3d89f 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -194,8 +194,7 @@ void sg_platf_new_cluster(ClusterCreationArgs* cluster) XBT_DEBUG("", 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; @@ -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(); @@ -521,22 +519,22 @@ void sg_platf_end() { /* Pick the right models for CPU, net and host, and call their model_init_preparse */ static void surf_config_models_setup() { - const char* host_model_name = xbt_cfg_get_string("host/model"); - const char* network_model_name = xbt_cfg_get_string("network/model"); - const char* cpu_model_name = xbt_cfg_get_string("cpu/model"); - const char* storage_model_name = xbt_cfg_get_string("storage/model"); + std::string host_model_name = xbt_cfg_get_string("host/model"); + std::string network_model_name = xbt_cfg_get_string("network/model"); + std::string cpu_model_name = xbt_cfg_get_string("cpu/model"); + std::string storage_model_name = xbt_cfg_get_string("storage/model"); /* The compound host model is needed when using non-default net/cpu models */ 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); - if (not strcmp(host_model_name, "compound")) { - xbt_assert(cpu_model_name, "Set a cpu model to use with the 'compound' host model"); - xbt_assert(network_model_name, "Set a network model to use with the 'compound' host model"); + XBT_DEBUG("host model: %s", host_model_name.c_str()); + if (host_model_name == "compound") { + xbt_assert(not cpu_model_name.empty(), "Set a cpu model to use with the 'compound' host model"); + xbt_assert(not network_model_name.empty(), "Set a network model to use with the 'compound' host model"); int cpu_id = find_model_description(surf_cpu_model_description, cpu_model_name); surf_cpu_model_description[cpu_id].model_init_preparse();