[glib] GHashTable: Explicitly document that _iter_remove() is safe while iterating



commit 6fcaa7aa96fc4b274a4358f2cec3a4075568d343
Author: Xavier Claessens <xavier claessens collabora com>
Date:   Fri Feb 21 15:35:36 2014 -0500

    GHashTable: Explicitly document that _iter_remove() is safe while iterating
    
    https://bugzilla.gnome.org/show_bug.cgi?id=723316

 glib/ghash.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/glib/ghash.c b/glib/ghash.c
index de05efd..23f4a44 100644
--- a/glib/ghash.c
+++ b/glib/ghash.c
@@ -809,6 +809,15 @@ iter_remove_or_steal (RealIter *ri, gboolean notify)
  * otherwise you have to make sure that any dynamically allocated
  * values are freed yourself.
  *
+ * It is safe to continue iterating the #GHashTable afterward:
+ * |[
+ * while (g_hash_table_iter_next (&iter, &key, &value))
+ *   {
+ *     if (condition)
+ *       g_hash_table_iter_remove (&iter);
+ *   }
+ * ]|
+ *
  * Since: 2.16
  */
 void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]