From eb2f6f6fc1052abfa05f016ab2aed0cd0c338992 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Thu, 29 Nov 2001 20:49:07 +0000 Subject: [PATCH] Add notes about how you shouldn't modify these data structures as you 2001-11-29 Havoc Pennington * glib/gtree.c (g_tree_foreach): * glib/ghash.c (g_hash_table_foreach): Add notes about how you shouldn't modify these data structures as you iterate over them. --- ChangeLog | 8 ++++++++ ChangeLog.pre-2-0 | 8 ++++++++ ChangeLog.pre-2-10 | 8 ++++++++ ChangeLog.pre-2-12 | 8 ++++++++ ChangeLog.pre-2-2 | 8 ++++++++ ChangeLog.pre-2-4 | 8 ++++++++ ChangeLog.pre-2-6 | 8 ++++++++ ChangeLog.pre-2-8 | 8 ++++++++ docs/reference/glib/tmpl/patterns.sgml | 4 ++++ docs/reference/glib/tmpl/unicode.sgml | 3 ++- glib/ghash.c | 9 ++++++--- glib/gtree.c | 6 +++++- 12 files changed, 81 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index b7342005..428ef553 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2001-11-29 Havoc Pennington + + * glib/gtree.c (g_tree_foreach): + * glib/ghash.c (g_hash_table_foreach): + + Add notes about how you shouldn't modify these data structures as + you iterate over them. + Thu Nov 29 11:16:03 2001 Owen Taylor * HACKING: Update (#65721, Dave Neary) diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index b7342005..428ef553 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,11 @@ +2001-11-29 Havoc Pennington + + * glib/gtree.c (g_tree_foreach): + * glib/ghash.c (g_hash_table_foreach): + + Add notes about how you shouldn't modify these data structures as + you iterate over them. + Thu Nov 29 11:16:03 2001 Owen Taylor * HACKING: Update (#65721, Dave Neary) diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index b7342005..428ef553 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,11 @@ +2001-11-29 Havoc Pennington + + * glib/gtree.c (g_tree_foreach): + * glib/ghash.c (g_hash_table_foreach): + + Add notes about how you shouldn't modify these data structures as + you iterate over them. + Thu Nov 29 11:16:03 2001 Owen Taylor * HACKING: Update (#65721, Dave Neary) diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index b7342005..428ef553 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,11 @@ +2001-11-29 Havoc Pennington + + * glib/gtree.c (g_tree_foreach): + * glib/ghash.c (g_hash_table_foreach): + + Add notes about how you shouldn't modify these data structures as + you iterate over them. + Thu Nov 29 11:16:03 2001 Owen Taylor * HACKING: Update (#65721, Dave Neary) diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index b7342005..428ef553 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,11 @@ +2001-11-29 Havoc Pennington + + * glib/gtree.c (g_tree_foreach): + * glib/ghash.c (g_hash_table_foreach): + + Add notes about how you shouldn't modify these data structures as + you iterate over them. + Thu Nov 29 11:16:03 2001 Owen Taylor * HACKING: Update (#65721, Dave Neary) diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index b7342005..428ef553 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,11 @@ +2001-11-29 Havoc Pennington + + * glib/gtree.c (g_tree_foreach): + * glib/ghash.c (g_hash_table_foreach): + + Add notes about how you shouldn't modify these data structures as + you iterate over them. + Thu Nov 29 11:16:03 2001 Owen Taylor * HACKING: Update (#65721, Dave Neary) diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index b7342005..428ef553 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,11 @@ +2001-11-29 Havoc Pennington + + * glib/gtree.c (g_tree_foreach): + * glib/ghash.c (g_hash_table_foreach): + + Add notes about how you shouldn't modify these data structures as + you iterate over them. + Thu Nov 29 11:16:03 2001 Owen Taylor * HACKING: Update (#65721, Dave Neary) diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index b7342005..428ef553 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,11 @@ +2001-11-29 Havoc Pennington + + * glib/gtree.c (g_tree_foreach): + * glib/ghash.c (g_hash_table_foreach): + + Add notes about how you shouldn't modify these data structures as + you iterate over them. + Thu Nov 29 11:16:03 2001 Owen Taylor * HACKING: Update (#65721, Dave Neary) diff --git a/docs/reference/glib/tmpl/patterns.sgml b/docs/reference/glib/tmpl/patterns.sgml index bbf1364a..d3de5db0 100644 --- a/docs/reference/glib/tmpl/patterns.sgml +++ b/docs/reference/glib/tmpl/patterns.sgml @@ -37,6 +37,10 @@ A GPatternSpec is the 'compiled' form of a pattern. This structure is opaque and its fields cannot be accessed directly. +@match_type: +@pattern_length: +@pattern: +@pattern_reversed: diff --git a/docs/reference/glib/tmpl/unicode.sgml b/docs/reference/glib/tmpl/unicode.sgml index b9811a66..b9edb0dc 100644 --- a/docs/reference/glib/tmpl/unicode.sgml +++ b/docs/reference/glib/tmpl/unicode.sgml @@ -46,8 +46,9 @@ A type which can hold any UTF-16 character code. -@charset: @Returns: + +@charset: diff --git a/glib/ghash.c b/glib/ghash.c index 40be7d39..2a121d73 100644 --- a/glib/ghash.c +++ b/glib/ghash.c @@ -536,9 +536,12 @@ g_hash_table_foreach_remove_or_steal (GHashTable *hash_table, * @func: the function to call for each key/value pair. * @user_data: user data to pass to the function. * - * Calls the given function for each of the key/value pairs in the #GHashTable. - * The function is passed the key and value of each pair, and the given - * @user_data parameter. + * Calls the given function for each of the key/value pairs in the + * #GHashTable. The function is passed the key and value of each + * pair, and the given @user_data parameter. The hash table may not + * be modified while iterating over it (you can't add/remove + * items). To remove all items matching a predicate, use + * g_hash_table_remove(). **/ void g_hash_table_foreach (GHashTable *hash_table, diff --git a/glib/gtree.c b/glib/gtree.c index 96a1b342..0546246c 100644 --- a/glib/gtree.c +++ b/glib/gtree.c @@ -442,7 +442,11 @@ g_tree_lookup_extended (GTree *tree, * * Calls the given function for each of the key/value pairs in the #GTree. * The function is passed the key and value of each pair, and the given - * @data parameter. + * @data parameter. The tree may not be modified while iterating over + * it (you can't add/remove items). To remove all items matching + * a predicate, you need to add each item to a list as in your + * #GTraverseFunc as you walk over the tree, then walk the list + * and remove each item. **/ void g_tree_foreach (GTree *tree, -- 2.34.1