Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
don't try to browse a dynar that has been freed
[simgrid.git] / examples / simdag / dot / dot_test2.c
index 8ea2f54..4a5af63 100644 (file)
@@ -12,6 +12,7 @@
 #include "xbt/log.h"
 #include "xbt/ex.h"
 #include <string.h>
+#define HAVE_JEDULE 0
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(test,
                              "Logging specific to this SimDag example");
@@ -26,8 +27,8 @@ int main(int argc, char **argv)
   SD_init(&argc, argv);
 
   /* Check our arguments */
-  if (argc < 1) {
-    INFO1("Usage: %s dot_file", argv[0]);
+  if (argc < 2) {
+    XBT_INFO("Usage: %s dot_file", argv[0]);
     exit(1);
   }
 
@@ -35,27 +36,24 @@ int main(int argc, char **argv)
   dot = SD_dotload(argv[1]);
 
   /* Display all the tasks */
-  INFO0
+  XBT_INFO
       ("------------------- Display all tasks of the loaded DAG ---------------------------");
   xbt_dynar_foreach(dot, cursor, task) {
       SD_task_dump(task);
     }
 
-  INFO0
+  XBT_INFO
       ("--------------------- Transform the dynar into an array ---------------------------");
   cursor=0;
   dot_as_array = (SD_task_t*) xbt_dynar_to_array(dot);
-  INFO0
+  XBT_INFO
       ("----------------------------- dump tasks again ------------------------------------");
   while ((task=dot_as_array[cursor++])){
     SD_task_dump(task);
-  }
-
-  xbt_dynar_foreach(dot, cursor, task) {
     SD_task_destroy(task);
   }
 
-  xbt_dynar_free_container(&dot);
+  free(dot_as_array);
 
   /* exit */
   SD_exit();