Don't insert unnecessary newlines in keyfiles. (#349825, Chris Wilson)
authorMatthias Clasen <mclasen@redhat.com>
Sat, 5 Aug 2006 21:57:35 +0000 (21:57 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Sat, 5 Aug 2006 21:57:35 +0000 (21:57 +0000)
2006-08-05  Matthias Clasen  <mclasen@redhat.com>

* glib/gkeyfile.c (g_key_file_to_data): Don't insert unnecessary
newlines in keyfiles.  (#349825, Chris Wilson)

ChangeLog
ChangeLog.pre-2-12
glib/gkeyfile.c

index bfa541feb1a117643ee0f0923bd061c6364b8b23..99d501cbeb76ea489a5dee318a8974cf316ccf7d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2006-08-05  Matthias Clasen  <mclasen@redhat.com>
 
+       * glib/gkeyfile.c (g_key_file_to_data): Don't insert unnecessary
+       newlines in keyfiles.  (#349825, Chris Wilson)
+
        * glib/guniprop.c (g_unichar_toupper, g_unichar_tolower) 
        (real_toupper, real_tolower): If a character can't be converted,
        don't replace it with a NUL byte, but leave it unchanged.  
index bfa541feb1a117643ee0f0923bd061c6364b8b23..99d501cbeb76ea489a5dee318a8974cf316ccf7d 100644 (file)
@@ -1,5 +1,8 @@
 2006-08-05  Matthias Clasen  <mclasen@redhat.com>
 
+       * glib/gkeyfile.c (g_key_file_to_data): Don't insert unnecessary
+       newlines in keyfiles.  (#349825, Chris Wilson)
+
        * glib/guniprop.c (g_unichar_toupper, g_unichar_tolower) 
        (real_toupper, real_tolower): If a character can't be converted,
        don't replace it with a NUL byte, but leave it unchanged.  
index 0f27df991356cff8cc5d7d9c8d20a51d4dfd8a89..764839173838ab8c7fb4b63b88afdb5b2236b57f 100644 (file)
@@ -943,12 +943,11 @@ g_key_file_to_data (GKeyFile  *key_file,
 
       group = (GKeyFileGroup *) group_node->data;
 
-      /* separate groups by an empty line */
-      if (group_node->next)
-        g_string_append_c (data_string, '\n');
-
       if (group->comment != NULL)
         g_string_append_printf (data_string, "%s\n", group->comment->value);
+      else if (group_node->next) /* separate groups by at least an empty line */
+        g_string_append_c (data_string, '\n');
+
       if (group->name != NULL)
         g_string_append_printf (data_string, "[%s]\n", group->name);