From d3a037231f5927cb5b358e6a3fee106a0d027432 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 28 Jan 2017 17:52:04 -0500 Subject: [PATCH] CmdCalc: Code cleanup --- src/commands/CmdCalc.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/commands/CmdCalc.cpp b/src/commands/CmdCalc.cpp index 6bbc5c6b0..0315c1216 100644 --- a/src/commands/CmdCalc.cpp +++ b/src/commands/CmdCalc.cpp @@ -54,10 +54,8 @@ CmdCalc::CmdCalc () int CmdCalc::execute (std::string& output) { // Configurable infix/postfix - bool infix = true; - if (context.config.get ("expressions") == "infix") - infix = true; - else if (context.config.get ("expressions") == "postfix") + auto infix {true}; + if (context.config.get ("expressions") == "postfix") infix = false; // Create an evaluator with DOM access. @@ -68,7 +66,7 @@ int CmdCalc::execute (std::string& output) // Compile all the args into one expression. std::string expression; - for (auto& word : context.cli2.getWords ()) + for (const auto& word : context.cli2.getWords ()) expression += word + ' '; // Evaluate according to preference.