Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cosmetics from patch review
[simgrid.git] / src / surf / surf_interface.cpp
index 05b3c8b..c48de1d 100644 (file)
@@ -16,6 +16,7 @@
 #include "mc/mc.h"
 #include "virtual_machine.hpp"
 #include "src/instr/instr_private.h" // TRACE_is_enabled(). FIXME: remove by subscribing tracing to the surf signals
+#include "simgrid/s4u/engine.hpp"
 
 XBT_LOG_NEW_CATEGORY(surf, "All SURF categories");
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_kernel, surf, "Logging specific to SURF (kernel)");
@@ -228,8 +229,8 @@ int find_model_description(s_surf_model_description_t * table,
   name_list = xbt_strdup(table[0].name);
   for (i = 1; table[i].name; i++) {
     name_list = (char *) xbt_realloc(name_list, strlen(name_list) + strlen(table[i].name) + 3);
-    strcat(name_list, ", ");
-    strcat(name_list, table[i].name);
+    strncat(name_list, ", ", 2);
+    strncat(name_list, table[i].name, strlen(table[i].name));
   }
   xbt_die("Model '%s' is invalid! Valid models are: %s.", name, name_list);
   return -1;
@@ -283,9 +284,11 @@ void surf_init(int *argc, char **argv)
   file_lib = xbt_lib_new();
   watched_hosts_lib = xbt_dict_new_homogeneous(NULL);
 
-
   XBT_DEBUG("Add routing levels");
   ROUTING_PROP_ASR_LEVEL = xbt_lib_add_level(as_router_lib, NULL);
+  ROUTING_ASR_LEVEL = xbt_lib_add_level(as_router_lib, [](void* p) {
+    delete static_cast<simgrid::surf::NetCard*>(p);
+  });
 
   XBT_DEBUG("Add SURF levels");
   simgrid::surf::HostImpl::classInit();
@@ -348,6 +351,7 @@ void surf_exit(void)
 
   tmgr_finalize();
   sg_platf_exit();
+  simgrid::s4u::Engine::shutdown();
 
   NOW = 0;                      /* Just in case the user plans to restart the simulation afterward */
 }
@@ -883,12 +887,8 @@ void Action::updateRemainingLazy(double now)
   }
   else
   {
-    xbt_assert(stateSet_ == getModel()->getRunningActionSet(),
-        "You're updating an action that is not running.");
-
-      /* bogus priority, skip it */
-    xbt_assert(priority_ > 0,
-        "You're updating an action that seems suspended.");
+    xbt_assert(stateSet_ == getModel()->getRunningActionSet(), "You're updating an action that is not running.");
+    xbt_assert(priority_ > 0, "You're updating an action that seems suspended.");
   }
 
   delta = now - lastUpdate_;