From 5fbf7c939a29076a829599a400c7e3ee7e5d45fb Mon Sep 17 00:00:00 2001 From: Christian Heinrich Date: Mon, 30 Oct 2017 10:21:13 +0100 Subject: [PATCH 1/1] [KERNEL] Replaced literal strings with variable. This error message was hardcoded several times. Replaced it with a const message. --- src/kernel/routing/FatTreeZone.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/kernel/routing/FatTreeZone.cpp b/src/kernel/routing/FatTreeZone.cpp index 4eb5f29a43..92301b4389 100644 --- a/src/kernel/routing/FatTreeZone.cpp +++ b/src/kernel/routing/FatTreeZone.cpp @@ -361,11 +361,11 @@ void FatTreeZone::parse_specific_arguments(ClusterCreationArgs* cluster) std::vector parameters; std::vector tmp; boost::split(parameters, cluster->topo_parameters, boost::is_any_of(";")); + const std::string error_msg {"Fat trees are defined by the levels number and 3 vectors, see the documentation for more information"}; // TODO : we have to check for zeros and negative numbers, or it might crash if (parameters.size() != 4) { - surf_parse_error( - "Fat trees are defined by the levels number and 3 vectors, see the documentation for more information"); + surf_parse_error(error_msg); } // The first parts of topo_parameters should be the levels number @@ -378,8 +378,7 @@ void FatTreeZone::parse_specific_arguments(ClusterCreationArgs* cluster) // Then, a l-sized vector standing for the children number by level boost::split(tmp, parameters[1], boost::is_any_of(",")); if (tmp.size() != this->levels_) { - surf_parse_error("Fat trees are defined by the levels number and 3 vectors" - ", see the documentation for more information"); + surf_parse_error(error_msg); } for (size_t i = 0; i < tmp.size(); i++) { try { @@ -392,8 +391,7 @@ void FatTreeZone::parse_specific_arguments(ClusterCreationArgs* cluster) // Then, a l-sized vector standing for the parents number by level boost::split(tmp, parameters[2], boost::is_any_of(",")); if (tmp.size() != this->levels_) { - surf_parse_error("Fat trees are defined by the levels number and 3 vectors" - ", see the documentation for more information"); + surf_parse_error(error_msg); } for (size_t i = 0; i < tmp.size(); i++) { try { @@ -406,8 +404,7 @@ void FatTreeZone::parse_specific_arguments(ClusterCreationArgs* cluster) // Finally, a l-sized vector standing for the ports number with the lower level boost::split(tmp, parameters[3], boost::is_any_of(",")); if (tmp.size() != this->levels_) { - surf_parse_error("Fat trees are defined by the levels number and 3 vectors" - ", see the documentation for more information"); + surf_parse_error(error_msg); } for (size_t i = 0; i < tmp.size(); i++) { try { -- 2.20.1