From: Martin Quinson Date: Thu, 15 Dec 2016 10:35:00 +0000 (+0100) Subject: small cosmetics advised by sonar X-Git-Tag: v3_14~51 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/d27569cf3d838674e1325b58e2b9184b5b700bf5?ds=sidebyside small cosmetics advised by sonar --- diff --git a/include/simgrid/s4u/NetZone.hpp b/include/simgrid/s4u/NetZone.hpp index 88cb05371f..3b3eb5f5a6 100644 --- a/include/simgrid/s4u/NetZone.hpp +++ b/include/simgrid/s4u/NetZone.hpp @@ -19,16 +19,12 @@ #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); diff --git a/src/kernel/routing/FatTreeZone.cpp b/src/kernel/routing/FatTreeZone.cpp index 20c84ab31f..7a0222aae7 100644 --- a/src/kernel/routing/FatTreeZone.cpp +++ b/src/kernel/routing/FatTreeZone.cpp @@ -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(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(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(linkTemplate.id)); uniqueId++; - free((void*)linkTemplate.id); } } } diff --git a/src/s4u/s4u_netzone.cpp b/src/s4u/s4u_netzone.cpp index 9950560f46..ed4aa1dd5d 100644 --- a/src/s4u/s4u_netzone.cpp +++ b/src/s4u/s4u_netzone.cpp @@ -34,7 +34,7 @@ NetZone::~NetZone() char* key; NetZone_t elem; xbt_dict_foreach (children_, cursor, key, elem) { - delete (NetZone*)elem; + delete static_cast(elem); } xbt_dict_free(&children_);