From 6aaed403abdae1f192b6e1040e89ae4c60e48b21 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sun, 25 Aug 2013 05:03:23 +0000 Subject: [PATCH] Cleanup parts of the code. git-svn-id: https://svn.dealii.org/trunk@30474 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/source/base/parameter_handler.cc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/deal.II/source/base/parameter_handler.cc b/deal.II/source/base/parameter_handler.cc index e420fc5d42..18c168f742 100644 --- a/deal.II/source/base/parameter_handler.cc +++ b/deal.II/source/base/parameter_handler.cc @@ -1325,8 +1325,7 @@ bool ParameterHandler::read_input (std::istream &input) { ++lineno; getline (input, line); - if (!scan_line (line, lineno)) - status = false; + status &= scan_line (line, lineno); } return status; @@ -1391,8 +1390,7 @@ bool ParameterHandler::read_input_from_string (const char *s) input.erase (0, input.find('\n')+1); ++lineno; - if (!scan_line (line, lineno)) - status = false; + status &= scan_line (line, lineno); } return status; @@ -2293,11 +2291,14 @@ ParameterHandler::scan_line (std::string line, line.erase (line.find(" "), 1); // now every existing whitespace // should be exactly one ' '; - // if at end or beginning: delete - if ((line.length() != 0) && (std::isspace (line[0]))) line.erase (0, 1); + // if at beginning: delete + if ((line.length() != 0) && (std::isspace (line[0]))) + line.erase (0, 1); // if line is now empty: leave - if (line.length() == 0) return true; + if (line.length() == 0) + return true; + // also delete spaces at the end if (std::isspace (line[line.length()-1])) line.erase (line.size()-1, 1); -- 2.39.5