Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] better include, no need to declare global_routing here, it is already externed
[simgrid.git] / src / instr / instr_routing.c
index 348a4d3..68ccec9 100644 (file)
@@ -7,11 +7,10 @@
 #include "instr/instr_private.h"
 
 #ifdef HAVE_TRACING
-#include "surf/surfxml_parse_private.h"
+#include "surf/surf_private.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_routing, instr, "Tracing platform hierarchy");
 
-extern routing_global_t global_routing; /* from surf/surf_routing.c */
 extern xbt_dict_t defined_types; /* from instr_interface.c */
 
 typedef struct s_container *container_t;
@@ -76,6 +75,8 @@ static void newVariableType (const char *type, const char *parentType, const cha
 
 void instr_routing_define_callbacks ()
 {
+  if (!TRACE_is_active())
+    return;
   surfxml_add_callback(STag_surfxml_AS_cb_list, &instr_routing_parse_start_AS);
   surfxml_add_callback(ETag_surfxml_AS_cb_list, &instr_routing_parse_end_AS);
   surfxml_add_callback(STag_surfxml_link_cb_list, &instr_routing_parse_start_link);
@@ -276,7 +277,7 @@ char *instr_host_type (const char *name)
 
 void instr_destroy_platform ()
 {
-  recursiveDestroyContainer (rootContainer);
+  if (rootContainer) recursiveDestroyContainer (rootContainer);
 }
 
 #endif /* HAVE_TRACING */