[glib/wip/antoniof/fallback-timezone-cache-lookup: 1/5] glist: Clarify that g_list_free() and friends only free an entire list




commit 53836e61b21093ea8c1c0ab21929c869e193c19e
Author: Philip Withnall <pwithnall endlessos org>
Date:   Tue Sep 22 16:41:55 2020 +0100

    glist: Clarify that g_list_free() and friends only free an entire list
    
    They shouldn’t be used to free a list from part-way through, as that
    is confusing and will leave a dangling pointer from the previous list
    element.
    
    Spotted by Gary Kramlich in !1653.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 glib/glist.c  | 4 ++--
 glib/gslist.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/glib/glist.c b/glib/glist.c
index 68673768d..cb9f5003e 100644
--- a/glib/glist.c
+++ b/glib/glist.c
@@ -173,7 +173,7 @@ g_list_alloc (void)
 
 /**
  * g_list_free: 
- * @list: a #GList
+ * @list: the first link of a #GList
  *
  * Frees all of the memory used by a #GList.
  * The freed elements are returned to the slice allocator.
@@ -217,7 +217,7 @@ g_list_free_1 (GList *list)
 
 /**
  * g_list_free_full:
- * @list: a pointer to a #GList
+ * @list: the first link of a #GList
  * @free_func: the function to be called to free each element's data
  *
  * Convenience method, which frees all the memory used by a #GList,
diff --git a/glib/gslist.c b/glib/gslist.c
index c0df55ff5..0e76de974 100644
--- a/glib/gslist.c
+++ b/glib/gslist.c
@@ -127,7 +127,7 @@ g_slist_alloc (void)
 
 /**
  * g_slist_free:
- * @list: a #GSList
+ * @list: the first link of a #GSList
  *
  * Frees all of the memory used by a #GSList.
  * The freed elements are returned to the slice allocator.
@@ -171,7 +171,7 @@ g_slist_free_1 (GSList *list)
 
 /**
  * g_slist_free_full:
- * @list: a pointer to a #GSList
+ * @list: the first link of a #GSList
  * @free_func: the function to be called to free each element's data
  *
  * Convenience method, which frees all the memory used by a #GSList, and


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