mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-23 18:52:09 +01:00
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.
This commit is contained in:
parent
fd2adc3f5d
commit
2be7079e87
@ -1,3 +1,11 @@
|
||||
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
|
||||
|
@ -1,3 +1,11 @@
|
||||
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
|
||||
|
@ -2665,7 +2665,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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user