Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
code simplification around simgrid::surf::NetCardImpl
[simgrid.git] / src / surf / surf_routing.hpp
index 6096197..5c59098 100644 (file)
@@ -110,8 +110,10 @@ public:
 
 struct XBT_PRIVATE NetCardImpl : public NetCard {
 public:
-  NetCardImpl(char *name, int id, e_surf_network_element_type_t rcType, As *rcComponent)
-  : p_rcComponent(rcComponent), p_rcType(rcType), m_id(id), p_name(name) {}
+  NetCardImpl(const char *name, e_surf_network_element_type_t rcType, As *rcComponent)
+  : p_rcComponent(rcComponent),
+    p_rcType(rcType),
+    p_name(xbt_strdup(name)) {}
   ~NetCardImpl() { xbt_free(p_name);};
 
   int getId() {return m_id;}
@@ -123,7 +125,7 @@ public:
 private:
   As *p_rcComponent;
   e_surf_network_element_type_t p_rcType;
-  int m_id;
+  int m_id = -1;
   char *p_name;
 };