Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use a more specific exception.
[simgrid.git] / src / mc / mc_smx.cpp
index cd22b6b..8be69df 100644 (file)
@@ -5,8 +5,8 @@
 
 #include "simgrid/s4u/Host.hpp"
 
-#include "src/mc/mc_smx.h"
 #include "src/mc/ModelChecker.hpp"
+#include "src/mc/mc_smx.hpp"
 
 using simgrid::mc::remote;
 
@@ -66,7 +66,7 @@ static void MC_process_refresh_simix_actor_dynar(simgrid::mc::RemoteClient* proc
   s_xbt_dynar_t dynar;
   process->read_bytes(&dynar, sizeof(dynar), remote_dynar);
 
-  smx_actor_t* data = (smx_actor_t*)malloc(dynar.elmsize * dynar.used);
+  smx_actor_t* data = static_cast<smx_actor_t*>(::operator new(dynar.elmsize * dynar.used));
   process->read_bytes(data, dynar.elmsize * dynar.used, dynar.data);
 
   // Load each element of the vector from the MCed process:
@@ -78,7 +78,7 @@ static void MC_process_refresh_simix_actor_dynar(simgrid::mc::RemoteClient* proc
     process->read_bytes(&info.copy, sizeof(info.copy), remote(data[i]));
     target.push_back(std::move(info));
   }
-  free(data);
+  ::operator delete(data);
 }
 namespace simgrid {
 namespace mc {
@@ -97,7 +97,6 @@ void RemoteClient::refresh_simix()
   static_assert(sizeof(simix_global) == sizeof(simgrid::simix::Global*),
     "Bad size for simix_global");
 
-  // simix_global_p = REMOTE(simix_global.get());
   RemotePtr<simgrid::simix::Global> simix_global_p =
     this->read_variable<simgrid::simix::Global*>("simix_global");
 
@@ -161,8 +160,8 @@ const char* MC_smx_actor_get_host_name(smx_actor_t actor)
   */
   union fake_host {
     simgrid::s4u::Host host;
-    fake_host() {}
-    ~fake_host() {}
+    fake_host() { /* Nothing to do*/}
+    ~fake_host() { /* Nothing to do*/}
   };
   fake_host foo;
   const size_t offset = (char*)&foo.host.getName() - (char*)&foo.host;
@@ -185,7 +184,7 @@ const char* MC_smx_actor_get_name(smx_actor_t actor)
 
   simgrid::mc::ActorInformation* info = actor_info_cast(actor);
   if (info->name.empty()) {
-    simgrid::xbt::string_data string_data = (simgrid::xbt::string_data&)actor->name;
+    simgrid::xbt::string_data string_data = simgrid::xbt::string::to_string_data(actor->name);
     info->name = process->read_string(remote(string_data.data), string_data.len);
   }
   return info->name.c_str();