Check the return values of g_tree_remove().

2005-05-17  Matthias Clasen  <mclasen@redhat.com>

	* tests/tree-test.c (main): Check the return values of
	g_tree_remove().

	* glib/gtree.c (g_tree_remove, g_tree_steal): Return
	a boolean indicating wether the key was found.  (#302545,
	Matthew F. Barnes)
This commit is contained in:
Matthias Clasen
2005-05-17 15:33:36 +00:00
committed by Matthias Clasen
parent 16d8ccb0b5
commit 0c04a92b2b
7 changed files with 76 additions and 13 deletions

View File

@@ -83,7 +83,9 @@ main (int argc,
{
gint i, j;
GTree *tree;
gboolean removed;
char chars[62];
char c;
tree = g_tree_new (my_compare);
i = 0;
@@ -108,7 +110,14 @@ main (int argc,
g_assert (g_tree_nnodes (tree) == (10 + 26 + 26));
for (i = 0; i < 10; i++)
g_tree_remove (tree, &chars[i]);
{
removed = g_tree_remove (tree, &chars[i]);
g_assert (removed);
}
c = '\0';
removed = g_tree_remove (tree, &c);
g_assert (removed == FALSE);
g_tree_foreach (tree, my_traverse, NULL);