From 71fc2f9e38d5398b84070f22e4b06ee5ab1b2e7a Mon Sep 17 00:00:00 2001 From: bangerth Date: Sun, 25 Aug 2013 05:06:53 +0000 Subject: [PATCH] Remove code duplication. git-svn-id: https://svn.dealii.org/trunk@30475 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/source/base/parameter_handler.cc | 31 +++--------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/deal.II/source/base/parameter_handler.cc b/deal.II/source/base/parameter_handler.cc index 18c168f742..21a47df92d 100644 --- a/deal.II/source/base/parameter_handler.cc +++ b/deal.II/source/base/parameter_handler.cc @@ -1367,33 +1367,10 @@ bool ParameterHandler::read_input (const std::string &filename, bool ParameterHandler::read_input_from_string (const char *s) { - // if empty std::string then exit - // with success - if ((s == 0) || ((*s) == 0)) return true; - - std::string line; - std::string input (s); - int lineno=0; - - // if necessary append a newline char - // to make all lines equal - if (input[input.length()-1] != '\n') - input += '\n'; - - bool status = true; - while (input.size() != 0) - { - // get one line from Input (=s) - line.assign (input, 0, input.find('\n')); - // delete this part including - // the backspace - input.erase (0, input.find('\n')+1); - ++lineno; - - status &= scan_line (line, lineno); - } - - return status; + // create an istringstream representation and pass it off + // to the other functions doing this work + std::istringstream in (s); + return read_input (in); } -- 2.39.5