Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
small cosmetics advised by sonar
authorMartin Quinson <martin.quinson@loria.fr>
Thu, 15 Dec 2016 10:35:00 +0000 (11:35 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Thu, 15 Dec 2016 14:47:20 +0000 (15:47 +0100)
include/simgrid/s4u/NetZone.hpp
src/kernel/routing/FatTreeZone.cpp
src/s4u/s4u_netzone.cpp

index 88cb053..3b3eb5f 100644 (file)
 #include "src/surf/xml/platf_private.hpp" // FIXME: kill sg_platf_route_cbarg_t to remove that UGLY include
 
 namespace simgrid {
-
-namespace surf {
-class Link;
-}
 namespace kernel {
 namespace routing {
 class NetZoneImpl;
-class NetCard;
 }
 }
+
 namespace s4u {
 
 /** @brief Networking Zones
@@ -50,11 +46,10 @@ public:
   virtual void seal();
   char* name();
   NetZone* father();
-  ;
+
   xbt_dict_t children(); // Sub netzones
   xbt_dynar_t hosts();   // my content as a dynar
 
-public:
   /* Add content to the netzone, at parsing time. It should be sealed afterward. */
   virtual int addComponent(kernel::routing::NetCard * elm); /* A host, a router or a netzone, whatever */
   virtual void addRoute(sg_platf_route_cbarg_t route);
index 20c84ab..7a0222a 100644 (file)
@@ -235,7 +235,6 @@ void FatTreeZone::generateSwitches()
 {
   XBT_DEBUG("Generating switches.");
   this->nodesByLevel_.resize(this->levels_ + 1, 0);
-  unsigned int nodesRequired = 0;
 
   // Take care of the number of nodes by level
   this->nodesByLevel_[0] = 1;
@@ -259,7 +258,6 @@ void FatTreeZone::generateSwitches()
       nodesInThisLevel *= this->lowerLevelNodesNumber_[j];
 
     this->nodesByLevel_[i + 1] = nodesInThisLevel;
-    nodesRequired += nodesInThisLevel;
   }
 
   // Create the switches
@@ -440,7 +438,7 @@ FatTreeNode::FatTreeNode(sg_platf_cluster_cbarg_t cluster, int id, int level, in
     linkTemplate.id        = bprintf("limiter_%d", id);
     sg_platf_new_link(&linkTemplate);
     this->limiterLink = Link::byName(linkTemplate.id);
-    free((void*)linkTemplate.id);
+    free(const_cast<char*>(linkTemplate.id));
   }
   if (cluster->loopback_bw || cluster->loopback_lat) {
     memset(&linkTemplate, 0, sizeof(linkTemplate));
@@ -450,7 +448,7 @@ FatTreeNode::FatTreeNode(sg_platf_cluster_cbarg_t cluster, int id, int level, in
     linkTemplate.id        = bprintf("loopback_%d", id);
     sg_platf_new_link(&linkTemplate);
     this->loopback = Link::byName(linkTemplate.id);
-    free((void*)linkTemplate.id);
+    free(const_cast<char*>(linkTemplate.id));
   }
 }
 
@@ -465,22 +463,18 @@ FatTreeLink::FatTreeLink(sg_platf_cluster_cbarg_t cluster, FatTreeNode* downNode
   linkTemplate.policy    = cluster->sharing_policy; // sthg to do with that ?
   linkTemplate.id        = bprintf("link_from_%d_to_%d_%d", downNode->id, upNode->id, uniqueId);
   sg_platf_new_link(&linkTemplate);
-  Link* link;
-  std::string tmpID;
+
   if (cluster->sharing_policy == SURF_LINK_FULLDUPLEX) {
-    tmpID          = std::string(linkTemplate.id) + "_UP";
-    link           = Link::byName(tmpID.c_str());
-    this->upLink   = link; // check link?
+    std::string tmpID = std::string(linkTemplate.id) + "_UP";
+    this->upLink      = Link::byName(tmpID.c_str()); // check link?
     tmpID          = std::string(linkTemplate.id) + "_DOWN";
-    link           = Link::byName(tmpID.c_str());
-    this->downLink = link; // check link ?
+    this->downLink    = Link::byName(tmpID.c_str()); // check link ?
   } else {
-    link           = Link::byName(linkTemplate.id);
-    this->upLink   = link;
-    this->downLink = link;
+    this->upLink   = Link::byName(linkTemplate.id);
+    this->downLink = this->upLink;
   }
+  free(const_cast<char*>(linkTemplate.id));
   uniqueId++;
-  free((void*)linkTemplate.id);
 }
 }
 }
index 9950560..ed4aa1d 100644 (file)
@@ -34,7 +34,7 @@ NetZone::~NetZone()
   char* key;
   NetZone_t elem;
   xbt_dict_foreach (children_, cursor, key, elem) {
-    delete (NetZone*)elem;
+    delete static_cast<NetZone*>(elem);
   }
 
   xbt_dict_free(&children_);