Commit 64434acf authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen
Browse files

Accept duplicate groups. (#157877, Sebastien Bacher)

2006-04-18  Matthias Clasen  <mclasen@redhat.com>

	* glib/gkeyfile.c (g_key_file_add_group): Accept duplicate
	groups.  (#157877, Sebastien Bacher)

	* tests/keyfile-test.c: Add tests for duplicate key and
	duplicate group handling.
parent 442ef9d9
2006-04-18 Matthias Clasen <mclasen@redhat.com>
* glib/gkeyfile.c (g_key_file_add_group): Accept duplicate
groups. (#157877, Sebastien Bacher)
* tests/keyfile-test.c: Add tests for duplicate key and
duplicate group handling.
2006-04-17 Matthias Clasen <mclasen@redhat.com>
* glib/gcompletion.c (g_completion_complete_utf8): Make passing
......
2006-04-18 Matthias Clasen <mclasen@redhat.com>
* glib/gkeyfile.c (g_key_file_add_group): Accept duplicate
groups. (#157877, Sebastien Bacher)
* tests/keyfile-test.c: Add tests for duplicate key and
duplicate group handling.
2006-04-17 Matthias Clasen <mclasen@redhat.com>
* glib/gcompletion.c (g_completion_complete_utf8): Make passing
......
......@@ -2660,7 +2660,9 @@ g_key_file_add_group (GKeyFile *key_file,
g_return_if_fail (key_file != NULL);
g_return_if_fail (group_name != NULL);
g_return_if_fail (g_key_file_lookup_group_node (key_file, group_name) == NULL);
if (g_key_file_lookup_group_node (key_file, group_name) != NULL)
return;
group = g_new0 (GKeyFileGroup, 1);
group->name = g_strdup (group_name);
......
......@@ -880,6 +880,37 @@ test_groups (void)
g_key_file_free (keyfile);
}
static void
test_duplicate_keys (void)
{
GKeyFile *keyfile;
const gchar *data =
"[1]\n"
"key1=123\n"
"key1=345\n";
keyfile = load_data (data, 0);
check_string_value (keyfile, "1", "key1", "345");
g_key_file_free (keyfile);
}
/* http://bugzilla.gnome.org/show_bug.cgi?id=157877 */
static void
test_duplicate_groups (void)
{
GKeyFile *keyfile;
const gchar *data =
"[Desktop Entry]\n"
"key1=123\n"
"[Desktop Entry]\n"
"key2=123\n";
keyfile = load_data (data, 0);
g_key_file_free (keyfile);
}
int
main (int argc, char *argv[])
......@@ -896,6 +927,8 @@ main (int argc, char *argv[])
test_group_remove ();
test_key_remove ();
test_groups ();
test_duplicate_keys ();
test_duplicate_groups ();
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment