Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
extra check on actions
[simgrid.git] / src / simdag / sd_dotloader.cpp
index 663dcb0..b4f8b3b 100644 (file)
@@ -7,7 +7,7 @@
 #include "simdag_private.hpp"
 #include "simgrid/simdag.h"
 #include "src/internal_config.h"
-#include "xbt/file.h"
+#include "xbt/file.hpp"
 #include <cstring>
 #include <unordered_map>
 
@@ -212,7 +212,7 @@ xbt_dynar_t SD_dotload_generic(const char* filename, bool sequential, bool sched
 
   if(schedule){
     if (schedule_success) {
-      const sg_host_t *workstations = sg_host_list ();
+      sg_host_t* workstations = sg_host_list();
       for (auto const& elm : computers) {
         SD_task_t previous_task = nullptr;
         for (auto const& task : *elm.second) {
@@ -227,6 +227,7 @@ xbt_dynar_t SD_dotload_generic(const char* filename, bool sequential, bool sched
         }
         delete elm.second;
       }
+      xbt_free(workstations);
     } else {
       XBT_WARN("The scheduling is ignored");
       for (auto const& elm : computers)
@@ -237,9 +238,8 @@ xbt_dynar_t SD_dotload_generic(const char* filename, bool sequential, bool sched
   }
 
   if (result && not acyclic_graph_detail(result)) {
-    char* base = xbt_basename(filename);
-    XBT_ERROR("The DOT described in %s is not a DAG. It contains a cycle.", base);
-    free(base);
+    std::string base = simgrid::xbt::Path(filename).getBasename();
+    XBT_ERROR("The DOT described in %s is not a DAG. It contains a cycle.", base.c_str());
     xbt_dynar_free(&result);
     result = nullptr;
   }