mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-09-20 01:06:15 +02: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
442ef9d902
commit
64434acfe1
@ -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>
|
2006-04-17 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* glib/gcompletion.c (g_completion_complete_utf8): Make passing
|
* 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>
|
2006-04-17 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* glib/gcompletion.c (g_completion_complete_utf8): Make passing
|
* 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 (key_file != NULL);
|
||||||
g_return_if_fail (group_name != 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 = g_new0 (GKeyFileGroup, 1);
|
||||||
group->name = g_strdup (group_name);
|
group->name = g_strdup (group_name);
|
||||||
|
@ -880,6 +880,37 @@ test_groups (void)
|
|||||||
g_key_file_free (keyfile);
|
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
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
@ -896,6 +927,8 @@ main (int argc, char *argv[])
|
|||||||
test_group_remove ();
|
test_group_remove ();
|
||||||
test_key_remove ();
|
test_key_remove ();
|
||||||
test_groups ();
|
test_groups ();
|
||||||
|
test_duplicate_keys ();
|
||||||
|
test_duplicate_groups ();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user