From 979453815cf6dcfa9ec4f2f6e9eef48a4cfb3d58 Mon Sep 17 00:00:00 2001
From: Houtan Bastani <houtan@dynare.org>
Date: Mon, 7 Oct 2019 11:29:11 +0200
Subject: [PATCH] simplify initialization of `hasModelChanged` variable in
 writing of output

---
 src/ModFile.cc | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/ModFile.cc b/src/ModFile.cc
index 1eed44bb..98db35d1 100644
--- a/src/ModFile.cc
+++ b/src/ModFile.cc
@@ -845,10 +845,7 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo
                           const filesystem::path &matlabroot,
                           const filesystem::path &dynareroot, bool onlymodel) const
 {
-  bool hasModelChanged = !dynamic_model.isChecksumMatching(basename, block);
-  if (!check_model_changes)
-    hasModelChanged = true;
-
+  bool hasModelChanged = !dynamic_model.isChecksumMatching(basename, block) || !check_model_changes;
   if (hasModelChanged)
     {
       // Erase possible remnants of previous runs
-- 
GitLab