From f3be1cf2d19acbe57cf61039efbf6adca84237b6 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 30 Nov 2007 03:40:56 +0000 Subject: [PATCH] =?utf8?q?Bug=20500361=20=E2=80=93=20Improve=20docs=20for?= =?utf8?q?=20g=5Farray=5Ffree()=20and=20g=5Fptr=5Farray=5Ffree()?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 2007-11-29 Behdad Esfahbod Bug 500361 – Improve docs for g_array_free() and g_ptr_array_free() * glib/tmpl/arrays.sgml: * glib/tmpl/arrays_pointer.sgml: Document how to free the return value. svn path=/trunk/; revision=5998 --- docs/reference/ChangeLog | 8 ++++++++ docs/reference/glib/tmpl/arrays.sgml | 5 +++-- docs/reference/glib/tmpl/arrays_pointer.sgml | 18 +++++++++++++----- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index f3e2813e..f6fd9965 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -1,3 +1,11 @@ +2007-11-29 Behdad Esfahbod + + Bug 500361 – Improve docs for g_array_free() and g_ptr_array_free() + + * glib/tmpl/arrays.sgml: + * glib/tmpl/arrays_pointer.sgml: + Document how to free the return value. + 2007-11-28 Matthias Clasen * gio/gio-sections.txt: More cleanup diff --git a/docs/reference/glib/tmpl/arrays.sgml b/docs/reference/glib/tmpl/arrays.sgml index 1e550498..c3aa40e9 100644 --- a/docs/reference/glib/tmpl/arrays.sgml +++ b/docs/reference/glib/tmpl/arrays.sgml @@ -298,12 +298,13 @@ the underlying array for use elsewhere. If array elements contain dynamically-allocated memory, they should be freed -first. +separately. @array: a #GArray. @free_segment: if %TRUE the actual element data is freed as well. -@Returns: the element data if @free_segment is %FALSE, otherwise %NULL +@Returns: the element data if @free_segment is %FALSE, otherwise %NULL. + The element data should be freed using g_free(). diff --git a/docs/reference/glib/tmpl/arrays_pointer.sgml b/docs/reference/glib/tmpl/arrays_pointer.sgml index 8612b8bc..25ae824d 100644 --- a/docs/reference/glib/tmpl/arrays_pointer.sgml +++ b/docs/reference/glib/tmpl/arrays_pointer.sgml @@ -227,14 +227,22 @@ Returns the pointer at the given index of the pointer array. -Frees all of the memory allocated for the pointer array. +Frees the memory allocated for the #GPtrArray. +If @free_segment is %TRUE it frees the memory block holding the elements +as well. Pass %FALSE if you want to free the #GPtrArray wrapper but preserve +the underlying array for use elsewhere. + + +If array contents point to dynamically-allocated memory, they should be freed +separately. + + @array: a #GPtrArray. -@free_seg: if %TRUE the array of pointers (@pdata) is freed. -@Returns: %NULL if @free_seg is %TRUE, otherwise the array of -pointers (@pdata) is returned. - +@free_seg: if %TRUE the actual pointer array is freed as well. +@Returns: the pointer array if @free_seg is %FALSE, otherwise %NULL. + The pointer array should be freed using g_free(). -- 2.34.1