Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
We need include simgrid_config.h for function getline.
[simgrid.git] / src / xbt / xbt_replay_trace_reader.c
index 9275ca8..d3b96df 100644 (file)
@@ -4,12 +4,12 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 #include "gras_config.h"
-#include "simgrid_config.h" /* getline */
 #include <errno.h>
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
 #include "xbt/str.h"
 #include "xbt/replay_trace_reader.h"
+#include "simgrid_config.h" //For getline
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(replay,xbt,"Replay trace reader");
 
@@ -39,12 +39,12 @@ const char *xbt_replay_trace_reader_position(xbt_replay_trace_reader_t reader)
   return reader->position;
 }
 
-char * const *xbt_replay_trace_reader_get(xbt_replay_trace_reader_t reader)
+const char **xbt_replay_trace_reader_get(xbt_replay_trace_reader_t reader)
 {
   ssize_t read;
   xbt_dynar_t d;
   read = getline(&reader->line, &reader->line_len, reader->fp);
-  //INFO1("got from trace: %s",reader->line);
+  //XBT_INFO("got from trace: %s",reader->line);
   reader->linenum++;
   if (read==-1)
     return NULL; /* end of file */
@@ -57,7 +57,7 @@ char * const *xbt_replay_trace_reader_get(xbt_replay_trace_reader_t reader)
 
   d=xbt_str_split_quoted_in_place(reader->line);
   if (xbt_dynar_length(d)==0) {
-    xbt_free(d);
+    xbt_dynar_free(&d);
     return xbt_replay_trace_reader_get(reader); /* Get next line */
   }
   return xbt_dynar_to_array(d);