Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Constify pointer and reference parameters in src/instr/.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 27 Dec 2019 22:19:09 +0000 (23:19 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 27 Dec 2019 22:19:09 +0000 (23:19 +0100)
include/simgrid/jedule/jedule_events.hpp
src/instr/instr_interface.cpp
src/instr/instr_platform.cpp
src/instr/instr_private.hpp
src/instr/jedule/jedule_events.cpp

index 5af7f4e..10a817a 100644 (file)
@@ -23,7 +23,7 @@ public:
       : name_(name), start_time_(start_time), end_time_(end_time), type_(type)
   {
   }
       : name_(name), start_time_(start_time), end_time_(end_time), type_(type)
   {
   }
-  void add_characteristic(char* characteristic);
+  void add_characteristic(const char* characteristic);
   void add_resources(const std::vector<sg_host_t>& host_selection);
   void add_info(char* key, char* value);
   void print(FILE* file) const;
   void add_resources(const std::vector<sg_host_t>& host_selection);
   void add_info(char* key, char* value);
   void print(FILE* file) const;
index ba355e2..be98a04 100644 (file)
@@ -25,13 +25,13 @@ std::set<std::string> user_link_variables;
 extern std::set<std::string> trivaNodeTypes;
 extern std::set<std::string> trivaEdgeTypes;
 
 extern std::set<std::string> trivaNodeTypes;
 extern std::set<std::string> trivaEdgeTypes;
 
-static xbt_dynar_t instr_set_to_dynar(std::set<std::string>* filter)
+static xbt_dynar_t instr_set_to_dynar(const std::set<std::string>& filter)
 {
   if (not TRACE_is_enabled() || not TRACE_needs_platform())
     return nullptr;
 
   xbt_dynar_t ret = xbt_dynar_new (sizeof(char*), &xbt_free_ref);
 {
   if (not TRACE_is_enabled() || not TRACE_needs_platform())
     return nullptr;
 
   xbt_dynar_t ret = xbt_dynar_new (sizeof(char*), &xbt_free_ref);
-  for (auto const& name : *filter)
+  for (auto const& name : filter)
     xbt_dynar_push_as(ret, char*, xbt_strdup(name.c_str()));
 
   return ret;
     xbt_dynar_push_as(ret, char*, xbt_strdup(name.c_str()));
 
   return ret;
@@ -123,7 +123,7 @@ xbt_dynar_t TRACE_get_categories ()
 {
   if (not TRACE_is_enabled() || not TRACE_categorized())
     return nullptr;
 {
   if (not TRACE_is_enabled() || not TRACE_categorized())
     return nullptr;
-  return instr_set_to_dynar(&created_categories);
+  return instr_set_to_dynar(created_categories);
 }
 
 /** @ingroup TRACE_mark
 }
 
 /** @ingroup TRACE_mark
@@ -258,7 +258,7 @@ xbt_dynar_t TRACE_get_marks ()
   if (not TRACE_is_enabled())
     return nullptr;
 
   if (not TRACE_is_enabled())
     return nullptr;
 
-  return instr_set_to_dynar(&declared_marks);
+  return instr_set_to_dynar(declared_marks);
 }
 
 static void instr_user_variable(double time, const char* resource, const char* variable_name, const char* father_type,
 }
 
 static void instr_user_variable(double time, const char* resource, const char* variable_name, const char* father_type,
@@ -620,7 +620,7 @@ void TRACE_host_variable_sub_with_time (double time, const char *host, const cha
  */
 xbt_dynar_t TRACE_get_host_variables ()
 {
  */
 xbt_dynar_t TRACE_get_host_variables ()
 {
-  return instr_set_to_dynar(&user_host_variables);
+  return instr_set_to_dynar(user_host_variables);
 }
 
 /* for link variables */
 }
 
 /* for link variables */
@@ -891,7 +891,7 @@ void TRACE_link_srcdst_variable_sub_with_time (double time, const char *src, con
  */
 xbt_dynar_t TRACE_get_link_variables ()
 {
  */
 xbt_dynar_t TRACE_get_link_variables ()
 {
-  return instr_set_to_dynar(&user_link_variables);
+  return instr_set_to_dynar(user_link_variables);
 }
 
 /** @ingroup TRACE_user_variables
 }
 
 /** @ingroup TRACE_user_variables
@@ -985,7 +985,7 @@ void TRACE_host_pop_state(const char* host, const char* state_name)
  */
 xbt_dynar_t TRACE_get_node_types ()
 {
  */
 xbt_dynar_t TRACE_get_node_types ()
 {
-  return instr_set_to_dynar(&trivaNodeTypes);
+  return instr_set_to_dynar(trivaNodeTypes);
 }
 
 /** @ingroup TRACE_API
 }
 
 /** @ingroup TRACE_API
@@ -998,5 +998,5 @@ xbt_dynar_t TRACE_get_node_types ()
  */
 xbt_dynar_t TRACE_get_edge_types ()
 {
  */
 xbt_dynar_t TRACE_get_edge_types ()
 {
-  return instr_set_to_dynar(&trivaEdgeTypes);
+  return instr_set_to_dynar(trivaEdgeTypes);
 }
 }
index dc63425..98bdf5c 100644 (file)
@@ -29,7 +29,7 @@ static const char* instr_node_name(xbt_node_t node)
   return static_cast<char*>(xbt_graph_node_get_data(node));
 }
 
   return static_cast<char*>(xbt_graph_node_get_data(node));
 }
 
-static container_t lowestCommonAncestor(container_t a1, container_t a2)
+static container_t lowestCommonAncestor(const simgrid::instr::Container* a1, const simgrid::instr::Container* a2)
 {
   // this is only an optimization (since most of a1 and a2 share the same parent)
   if (a1->father_ == a2->father_)
 {
   // this is only an optimization (since most of a1 and a2 share the same parent)
   if (a1->father_ == a2->father_)
@@ -517,7 +517,7 @@ xbt_graph_t instr_routing_platform_graph()
   return ret;
 }
 
   return ret;
 }
 
-void instr_routing_platform_graph_export_graphviz(xbt_graph_t g, const char* filename)
+void instr_routing_platform_graph_export_graphviz(const s_xbt_graph_t* g, const char* filename)
 {
   unsigned int cursor = 0;
   xbt_node_t node     = nullptr;
 {
   unsigned int cursor = 0;
   xbt_node_t node     = nullptr;
index 228d6fa..ff39b1a 100644 (file)
@@ -291,6 +291,6 @@ XBT_PRIVATE std::string TRACE_get_filename();
 
 /* instr_platform */
 xbt_graph_t instr_routing_platform_graph();
 
 /* instr_platform */
 xbt_graph_t instr_routing_platform_graph();
-void instr_routing_platform_graph_export_graphviz(xbt_graph_t g, const char* filename);
+void instr_routing_platform_graph_export_graphviz(const s_xbt_graph_t* g, const char* filename);
 
 #endif
 
 #endif
index 2744fcd..e164058 100644 (file)
@@ -17,7 +17,7 @@ void Event::add_resources(const std::vector<sg_host_t>& host_selection)
   get_resource_selection_by_hosts(this->resource_subsets_, host_selection);
 }
 
   get_resource_selection_by_hosts(this->resource_subsets_, host_selection);
 }
 
-void Event::add_characteristic(char* characteristic)
+void Event::add_characteristic(const char* characteristic)
 {
   xbt_assert( characteristic != nullptr );
   this->characteristics_list_.push_back(characteristic);
 {
   xbt_assert( characteristic != nullptr );
   this->characteristics_list_.push_back(characteristic);