From 7ca0938c68d7ab5644571795a93cb34b82a2cfe5 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Sat, 12 Oct 2019 15:24:58 +0200 Subject: [PATCH] [cppcheck] Reduce scope for variables. --- src/plugins/host_energy.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/host_energy.cpp b/src/plugins/host_energy.cpp index 8853214cf1..2b62506659 100644 --- a/src/plugins/host_energy.cpp +++ b/src/plugins/host_energy.cpp @@ -199,11 +199,12 @@ void HostEnergy::update() HostEnergy::HostEnergy(simgrid::s4u::Host* ptr) : host_(ptr), last_updated_(surf_get_clock()) { init_watts_range_list(); - static bool warned = false; const char* off_power_str = host_->get_property("wattage_off"); if (off_power_str == nullptr) { off_power_str = host_->get_property("watt_off"); + + static bool warned = false; if (off_power_str != nullptr && not warned) { warned = true; XBT_WARN("Please use 'wattage_off' instead of 'watt_off' to define the idle wattage of hosts in your XML."); @@ -355,13 +356,12 @@ void HostEnergy::init_watts_range_list() boost::split(current_power_values, current_power_values_str, boost::is_any_of(":")); double p_idle = xbt_str_parse_double((current_power_values.at(0)).c_str(), "Invalid obsolete XML file. Fix your watt_per_state property."); - double p_one_core; double p_full; double p_epsilon; if (current_power_values.size() == 3) { - p_one_core = xbt_str_parse_double((current_power_values.at(1)).c_str(), - "Invalid obsolete XML file. Fix your watt_per_state property."); + double p_one_core = xbt_str_parse_double((current_power_values.at(1)).c_str(), + "Invalid obsolete XML file. Fix your watt_per_state property."); p_full = xbt_str_parse_double((current_power_values.at(2)).c_str(), "Invalid obsolete XML file. Fix your watt_per_state property."); if (host_->get_core_count() == 1) { -- 2.20.1