Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use xbt_malloc() and friends.
[simgrid.git] / src / s4u / s4u_Host.cpp
index 746d4d3..f8c8190 100644 (file)
@@ -25,9 +25,9 @@ template class Extendable<s4u::Host>;
 namespace s4u {
 
 xbt::signal<void(Host&)> Host::on_creation;
-xbt::signal<void(Host&)> Host::on_destruction;
-xbt::signal<void(Host&)> Host::on_state_change;
-xbt::signal<void(Host&)> Host::on_speed_change;
+xbt::signal<void(Host const&)> Host::on_destruction;
+xbt::signal<void(Host const&)> Host::on_state_change;
+xbt::signal<void(Host const&)> Host::on_speed_change;
 
 Host::Host(const std::string& name) : name_(name)
 {
@@ -338,7 +338,7 @@ sg_host_t* sg_host_list()
   xbt_assert(sg_host_count() > 0, "There is no host!");
   std::vector<simgrid::s4u::Host*> hosts = simgrid::s4u::Engine::get_instance()->get_all_hosts();
 
-  sg_host_t* res = (sg_host_t*)malloc(sizeof(sg_host_t) * hosts.size());
+  sg_host_t* res = xbt_new(sg_host_t, hosts.size());
   memcpy(res, hosts.data(), sizeof(sg_host_t) * hosts.size());
 
   return res;