From d21869b58082fe23cad31412552eb9a320b597d0 Mon Sep 17 00:00:00 2001
From: andy <a.heather@opencfd.co.uk>
Date: Fri, 13 Feb 2009 14:13:51 +0000
Subject: [PATCH] cosmetics

---
 src/OpenFOAM/db/dictionary/dictionaryIO.C | 30 ++++++++++++-----------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/src/OpenFOAM/db/dictionary/dictionaryIO.C b/src/OpenFOAM/db/dictionary/dictionaryIO.C
index 243799231f2..2f0987d16b7 100644
--- a/src/OpenFOAM/db/dictionary/dictionaryIO.C
+++ b/src/OpenFOAM/db/dictionary/dictionaryIO.C
@@ -79,12 +79,7 @@ bool Foam::dictionary::substituteKeyword(const word& keyword)
     {
         const dictionary& addDict = ePtr->dict();
 
-        for
-        (
-            IDLList<entry>::const_iterator iter = addDict.begin();
-            iter != addDict.end();
-            ++iter
-        )
+        forAllConstIter(IDLList<entry>, addDict, iter)
         {
             add(iter());
         }
@@ -152,15 +147,22 @@ void Foam::dictionary::write(Ostream& os, bool subDict) const
         os << nl << indent << token::BEGIN_BLOCK << incrIndent << nl;
     }
 
-    for
-    (
-        IDLList<entry>::const_iterator iter = begin();
-        iter != end();
-        ++iter
-    )
+    forAllConstIter(IDLList<entry>, *this, iter)
     {
-        // Write entry & follow with carriage return.
-        os << *iter;
+        const entry& e = *iter;
+
+        // Write entry
+        os << e;
+
+        // Add new line if applicable
+        if
+        (
+            (e.isDict() || (!e.isDict() && parent()==dictionary::null))
+         && e != *last()
+        )
+        {
+            os << nl;
+        }
 
         // Check stream before going to next entry.
         if (!os.good())
-- 
GitLab