Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
optimize perf - part 2
[simgrid.git] / src / msg / msg_environment.cpp
index 15f3b15..65a7a8c 100644 (file)
@@ -13,6 +13,8 @@
 #include <lualib.h>
 #endif
 
+SG_BEGIN_DECL()
+
 /********************************* MSG **************************************/
 
 /** \ingroup msg_simulation
@@ -78,5 +80,13 @@ void MSG_environment_as_set_property_value(msg_netzone_t netzone, const char* na
 
 xbt_dynar_t MSG_environment_as_get_hosts(msg_netzone_t netzone)
 {
-  return netzone->hosts();
+  xbt_dynar_t res = xbt_dynar_new(sizeof(sg_host_t), nullptr);
+
+  for (auto host : *netzone->hosts()) {
+    xbt_dynar_push(res, &host);
+  }
+
+  return res;
 }
+
+SG_END_DECL()