Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fixing building warning.
[simgrid.git] / src / xbt / graph.c
index 2079dfc..7dc01d1 100644 (file)
@@ -85,13 +85,13 @@ xbt_edge_t xbt_graph_get_edge(xbt_graph_t g, xbt_node_t src,
   unsigned int cursor;
 
   xbt_dynar_foreach(src->out, cursor, edge) {
-    DEBUG3("%p = %p--%p", edge, edge->src, edge->dst);
+    XBT_DEBUG("%p = %p--%p", edge, edge->src, edge->dst);
     if ((edge->src == src) && (edge->dst == dst))
       return edge;
   }
   if (!g->directed) {
     xbt_dynar_foreach(src->out, cursor, edge) {
-      DEBUG3("%p = %p--%p", edge, edge->src, edge->dst);
+      XBT_DEBUG("%p = %p--%p", edge, edge->src, edge->dst);
       if ((edge->dst == src) && (edge->src == dst))
         return edge;
     }
@@ -159,7 +159,7 @@ void xbt_graph_free_graph(xbt_graph_t g,
   if (graph_free_function)
     (*graph_free_function) (g->data);
   free(g);
-
+  xbt_graph_parse_lex_destroy();
   return;
 }
 
@@ -440,7 +440,7 @@ xbt_edge_t *xbt_graph_spanning_tree_prim(xbt_graph_t g)
   xbt_heap_t heap = xbt_heap_new(10, NULL);
   unsigned int cursor;
 
-  xbt_assert0(!(g->directed),
+  xbt_assert(!(g->directed),
               "Spanning trees do not make sense on directed graphs");
 
   xbt_dynar_foreach(g->nodes, cursor, node) {
@@ -528,7 +528,7 @@ void xbt_graph_depth_visit(xbt_graph_t g, xbt_node_t n,
   if (*((int *) (n->xbtdata)) == ALREADY_EXPLORED)
     return;
   else if (*((int *) (n->xbtdata)) == CURRENTLY_EXPLORING)
-    THROW0(0, 0, "There is a cycle");
+    THROWF(0, 0, "There is a cycle");
   else {
     *((int *) (n->xbtdata)) = CURRENTLY_EXPLORING;
 
@@ -552,7 +552,7 @@ static void *(*__parse_edge_label_and_data) (xbt_edge_t, const char *,
 
 static void __parse_graph_begin(void)
 {
-  DEBUG0("<graph>");
+  XBT_DEBUG("<graph>");
   if (A_graphxml_graph_isDirected == A_graphxml_graph_isDirected_true)
     parsed_graph = xbt_graph_new_graph(1, NULL);
   else
@@ -564,14 +564,14 @@ static void __parse_graph_begin(void)
 static void __parse_graph_end(void)
 {
   xbt_dict_free(&parsed_nodes);
-  DEBUG0("</graph>");
+  XBT_DEBUG("</graph>");
 }
 
 static void __parse_node(void)
 {
   xbt_node_t node = xbt_graph_new_node(parsed_graph, NULL);
 
-  DEBUG1("<node name=\"%s\"/>", A_graphxml_node_name);
+  XBT_DEBUG("<node name=\"%s\"/>", A_graphxml_node_name);
   if (__parse_node_label_and_data)
     node->data = __parse_node_label_and_data(node, A_graphxml_node_label,
                                              A_graphxml_node_data);
@@ -598,7 +598,7 @@ static void __parse_edge(void)
 
   xbt_graph_parse_get_double(&(edge->length), A_graphxml_edge_length);
 
-  DEBUG3("<edge  source=\"%s\" target=\"%s\" length=\"%f\"/>",
+  XBT_DEBUG("<edge  source=\"%s\" target=\"%s\" length=\"%f\"/>",
          (char *) (edge->src)->data,
          (char *) (edge->dst)->data, xbt_graph_edge_get_length(edge));
 }
@@ -626,7 +626,9 @@ xbt_graph_t xbt_graph_read(const char *filename,
   ETag_graphxml_edge_fun = __parse_edge;
 
   xbt_graph_parse_open(filename);
-  xbt_assert1((!(*xbt_graph_parse) ()), "Parse error in %s", filename);
+  int res;
+  res = (*xbt_graph_parse) ();
+  xbt_assert(!res, "Parse error in %s", filename);
   xbt_graph_parse_close();
 
   graph = parsed_graph;
@@ -647,7 +649,7 @@ void xbt_graph_export_graphviz(xbt_graph_t g, const char *filename,
   const char *name = NULL;
 
   file = fopen(filename, "w");
-  xbt_assert1(file, "Failed to open %s \n", filename);
+  xbt_assert(file, "Failed to open %s \n", filename);
 
   if (g->directed)
     fprintf(file, "digraph test {\n");
@@ -693,7 +695,7 @@ void xbt_graph_export_graphxml(xbt_graph_t g, const char *filename,
   const char *name = NULL;
 
   file = fopen(filename, "w");
-  xbt_assert1(file, "Failed to open %s \n", filename);
+  xbt_assert(file, "Failed to open %s \n", filename);
 
   fprintf(file, "<?xml version='1.0'?>\n");
   fprintf(file, "<!DOCTYPE graph SYSTEM \"graphxml.dtd\">\n");