From 12c873f79edde566154ef53d3c3f25b6555a0435 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Thu, 5 Jan 2017 00:16:02 +0100 Subject: [PATCH] cosmetics --- src/kernel/routing/FullZone.cpp | 16 +++++----------- src/kernel/routing/RoutedZone.cpp | 3 ++- src/kernel/routing/RoutedZone.hpp | 2 +- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/kernel/routing/FullZone.cpp b/src/kernel/routing/FullZone.cpp index 93210c6422..d9b0babfc8 100644 --- a/src/kernel/routing/FullZone.cpp +++ b/src/kernel/routing/FullZone.cpp @@ -20,20 +20,16 @@ FullZone::FullZone(NetZone* father, const char* name) : RoutedZone(father, name) void FullZone::seal() { - int i; - sg_platf_route_cbarg_t e_route; - - /* set utils vars */ int table_size = static_cast(vertices_.size()); - /* Create table if necessary */ + /* Create table if needed */ if (!routingTable_) routingTable_ = xbt_new0(sg_platf_route_cbarg_t, table_size * table_size); /* Add the loopback if needed */ if (surf_network_model->loopback_ && hierarchy_ == RoutingMode::base) { - for (i = 0; i < table_size; i++) { - e_route = TO_ROUTE_FULL(i, i); + for (int i = 0; i < table_size; i++) { + sg_platf_route_cbarg_t e_route = TO_ROUTE_FULL(i, i); if (!e_route) { e_route = xbt_new0(s_sg_platf_route_cbarg_t, 1); e_route->gw_src = nullptr; @@ -102,8 +98,7 @@ void FullZone::addRoute(sg_platf_route_cbarg_t route) dst->cname()); /* Add the route to the base */ - TO_ROUTE_FULL(src->id(), dst->id()) = newExtendedRoute(hierarchy_, route, 1); - TO_ROUTE_FULL(src->id(), dst->id())->link_list->shrink_to_fit(); + TO_ROUTE_FULL(src->id(), dst->id()) = newExtendedRoute(hierarchy_, route, true); if (route->symmetrical == true && src != dst) { if (route->gw_dst && route->gw_src) { @@ -121,8 +116,7 @@ void FullZone::addRoute(sg_platf_route_cbarg_t route) "The route between %s and %s already exists. You should not declare the reverse path as symmetrical.", dst->cname(), src->cname()); - TO_ROUTE_FULL(dst->id(), src->id()) = newExtendedRoute(hierarchy_, route, 0); - TO_ROUTE_FULL(dst->id(), src->id())->link_list->shrink_to_fit(); + TO_ROUTE_FULL(dst->id(), src->id()) = newExtendedRoute(hierarchy_, route, false); } } } diff --git a/src/kernel/routing/RoutedZone.cpp b/src/kernel/routing/RoutedZone.cpp index b559691c76..5209a95e81 100644 --- a/src/kernel/routing/RoutedZone.cpp +++ b/src/kernel/routing/RoutedZone.cpp @@ -129,7 +129,7 @@ void RoutedZone::getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) /* ************************* GENERIC AUX FUNCTIONS ************************** */ /* change a route containing link names into a route containing link entities */ sg_platf_route_cbarg_t RoutedZone::newExtendedRoute(RoutingMode hierarchy, sg_platf_route_cbarg_t routearg, - int change_order) + bool change_order) { sg_platf_route_cbarg_t result; @@ -152,6 +152,7 @@ sg_platf_route_cbarg_t RoutedZone::newExtendedRoute(RoutingMode hierarchy, sg_pl else result->link_list->insert(result->link_list->begin(), link); } + result->link_list->shrink_to_fit(); return result; } diff --git a/src/kernel/routing/RoutedZone.hpp b/src/kernel/routing/RoutedZone.hpp index 18c122b65e..c90df9de0b 100644 --- a/src/kernel/routing/RoutedZone.hpp +++ b/src/kernel/routing/RoutedZone.hpp @@ -54,7 +54,7 @@ public: void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges) override; virtual sg_platf_route_cbarg_t newExtendedRoute(RoutingMode hierarchy, sg_platf_route_cbarg_t routearg, - int change_order); + bool change_order); protected: void getRouteCheckParams(NetCard* src, NetCard* dst); -- 2.20.1