Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cosmetics: this is a bool
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 8 Jun 2018 09:01:23 +0000 (11:01 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 8 Jun 2018 09:01:23 +0000 (11:01 +0200)
include/simgrid/kernel/resource/Action.hpp
src/kernel/resource/Action.cpp
src/plugins/vm/VirtualMachineImpl.cpp

index 5c33f5b..9ed8456 100644 (file)
@@ -158,7 +158,7 @@ public:
   void ref();
   /** @brief Unref that action (and destroy it if refcount reaches 0)
    *  @return true if the action was destroyed and false if someone still has references on it */
-  int unref();
+  bool unref();
 
   /** @brief Cancel the current Action if running */
   virtual void cancel();
index 86f2e2a..4615d31 100644 (file)
@@ -149,14 +149,14 @@ void Action::cancel()
   }
 }
 
-int Action::unref()
+bool Action::unref()
 {
   refcount_--;
   if (not refcount_) {
     delete this;
-    return 1;
+    return true;
   }
-  return 0;
+  return false;
 }
 
 void Action::suspend()
index 07bb169..e57230a 100644 (file)
@@ -135,8 +135,8 @@ VirtualMachineImpl::~VirtualMachineImpl()
     allVms_.erase(iter);
 
   /* Free the cpu_action of the VM. */
-  XBT_ATTRIB_UNUSED int ret = action_->unref();
-  xbt_assert(ret == 1, "Bug: some resource still remains");
+  XBT_ATTRIB_UNUSED bool ret = action_->unref();
+  xbt_assert(ret, "Bug: some resource still remains");
 }
 
 void VirtualMachineImpl::suspend(smx_actor_t issuer)
@@ -252,7 +252,8 @@ void VirtualMachineImpl::set_physical_host(s4u::Host* destination)
     new_cpu_action->set_bound(old_bound);
   }
 
-  xbt_assert(action_->unref() == 1, "Bug: some resource still remains");
+  XBT_ATTRIB_UNUSED bool ret = action_->unref();
+  xbt_assert(ret, "Bug: some resource still remains");
 
   action_ = new_cpu_action;