Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
move some content from AsNone into As (AsNone should die)
authorMartin Quinson <martin.quinson@loria.fr>
Wed, 13 Jan 2016 22:26:33 +0000 (23:26 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Wed, 13 Jan 2016 22:26:33 +0000 (23:26 +0100)
src/surf/surf_routing.hpp
src/surf/surf_routing_none.cpp

index 7fdd860..600edf1 100644 (file)
@@ -48,15 +48,15 @@ public:
  */
 class As {
 public:
-  xbt_dynar_t p_indexNetworkElm;
+  xbt_dynar_t p_indexNetworkElm = xbt_dynar_new(sizeof(char*),NULL);
   xbt_dict_t p_bypassRoutes;    /* store bypass routes */
   routing_model_description_t p_modelDesc;
   e_surf_routing_hierarchy_t p_hierarchy;
-  char *p_name;
-  As *p_routingFather;
-  xbt_dict_t p_routingSons;
+  char *p_name = nullptr;
+  As *p_routingFather = nullptr;
+  xbt_dict_t p_routingSons = xbt_dict_new_homogeneous(NULL);
   NetCard *p_netElem;
-  xbt_dynar_t p_linkUpDownList;
+  xbt_dynar_t p_linkUpDownList = NULL;
 
   /**
    * @brief The As constructor
@@ -67,9 +67,12 @@ public:
    * @brief The As destructor
    */
   virtual ~As(){
-       xbt_free(p_name);
-       if (p_netElem)
-               delete p_netElem;
+    xbt_dict_free(&p_routingSons);
+    xbt_dynar_free(&p_indexNetworkElm);
+    xbt_dynar_free(&p_linkUpDownList);
+    xbt_free(p_name);
+    if (p_netElem)
+      delete p_netElem;
   };
 
   /**
index 2ea5660..989730d 100644 (file)
@@ -63,15 +63,9 @@ void AsNone::parseBypassroute(sg_platf_route_cbarg_t /*e_route*/){
 
 /* Creation routing model functions */
 AsNone::AsNone() {
-  p_routingSons = xbt_dict_new_homogeneous(NULL);
-  p_indexNetworkElm = xbt_dynar_new(sizeof(char*),NULL);
-  p_linkUpDownList = NULL;
 }
 
 AsNone::~AsNone() {
-  xbt_dict_free(&p_routingSons);
-  xbt_dynar_free(&p_indexNetworkElm);
-  xbt_dynar_free(&p_linkUpDownList);
 }
 
 }