GNOME Bugzilla – Bug 349825
GKeyFile always inserts a newline before a group
Last modified: 2011-02-18 15:49:58 UTC
Back in 2006-06-14, g_key_file_to_data beautified its output by inserting a newline before each group (bug #344868). Since then my key files have been quietly growing.... Perhaps: Index: glib/gkeyfile.c =================================================================== RCS file: /cvs/gnome/glib/glib/gkeyfile.c,v retrieving revision 1.44 diff -u -p -r1.44 gkeyfile.c --- glib/gkeyfile.c 14 Jun 2006 13:48:27 -0000 1.44 +++ glib/gkeyfile.c 3 Aug 2006 18:46:12 -0000 @@ -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) - 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);
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)