From: Matthias Clasen Date: Sat, 5 Aug 2006 21:57:35 +0000 (+0000) Subject: Don't insert unnecessary newlines in keyfiles. (#349825, Chris Wilson) X-Git-Tag: GLIB_2_12_2~21 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e94c42bd46382cabf70c5cc6dc356d586188423b;p=platform%2Fupstream%2Fglib.git Don't insert unnecessary newlines in keyfiles. (#349825, Chris Wilson) 2006-08-05 Matthias Clasen * glib/gkeyfile.c (g_key_file_to_data): Don't insert unnecessary newlines in keyfiles. (#349825, Chris Wilson) --- diff --git a/ChangeLog b/ChangeLog index bfa541f..99d501c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2006-08-05 Matthias Clasen + * 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. diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index bfa541f..99d501c 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,5 +1,8 @@ 2006-08-05 Matthias Clasen + * 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. diff --git a/glib/gkeyfile.c b/glib/gkeyfile.c index 0f27df9..7648391 100644 --- a/glib/gkeyfile.c +++ b/glib/gkeyfile.c @@ -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);