Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Declare local variables inside the if statement.
[simgrid.git] / src / plugins / link_energy_wifi.cpp
index 60d067b..954a54f 100644 (file)
@@ -211,8 +211,7 @@ void LinkEnergyWifi::init_watts_range_list()
   Set to 0 if you do not want to compute beacons,
   otherwise to the duration of beacons transmissions per second
   */
-  const char* beacons_factor = this->link_->get_property("control_duration");
-  if(beacons_factor != nullptr) {
+  if (const char* beacons_factor = this->link_->get_property("control_duration")) {
     try {
       control_duration_ = std::stod(beacons_factor);
     } catch (const std::invalid_argument&) {