From 2b835a5006e2775ab6aa92a4a0ec1bf2c1fdf308 Mon Sep 17 00:00:00 2001
From: Houtan Bastani <houtan@dynare.org>
Date: Tue, 6 Sep 2016 14:58:09 +0200
Subject: [PATCH] preprocessor: simplify code

---
 Shocks.cc | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/Shocks.cc b/Shocks.cc
index 9cea0e2d..1216a40b 100644
--- a/Shocks.cc
+++ b/Shocks.cc
@@ -389,19 +389,13 @@ ConditionalForecastPathsStatement::writeOutput(ostream &output, const string &ba
          << "constrained_paths_ = zeros(" << paths.size() << ", " << path_length << ");" << endl;
 
   int k = 1;
-
   for (AbstractShocksStatement::det_shocks_t::const_iterator it = paths.begin();
-       it != paths.end(); it++)
+       it != paths.end(); it++, k++)
     {
       if (it == paths.begin())
-        {
-          output << "constrained_vars_ = " << symbol_table.getTypeSpecificID(it->first) + 1 << ";" << endl;
-        }
+        output << "constrained_vars_ = " << symbol_table.getTypeSpecificID(it->first) + 1 << ";" << endl;
       else
-        {
-          output << "constrained_vars_ = [constrained_vars_; " << symbol_table.getTypeSpecificID(it->first) + 1 << "];" << endl;
-        }
-
+        output << "constrained_vars_ = [constrained_vars_; " << symbol_table.getTypeSpecificID(it->first) + 1 << "];" << endl;
 
       const vector<AbstractShocksStatement::DetShockElement> &elems = it->second;
       for (int i = 0; i < (int) elems.size(); i++)
@@ -411,7 +405,6 @@ ConditionalForecastPathsStatement::writeOutput(ostream &output, const string &ba
             elems[i].value->writeOutput(output);
             output << ";" << endl;
           }
-      k++;
     }
 }
 
-- 
GitLab