mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-23 15:49:16 +02:00
Revert "Optimize g_[s]list_free_full a bit"
This reverts commit 98b667d052b1274f80b8898a32d0753e9e2e5c1a. The commit was not actually an optimization, since g_list_free is pretty smart.
This commit is contained in:
parent
dbb78fe57d
commit
d15f8682c0
11
glib/glist.c
11
glib/glist.c
@ -212,15 +212,10 @@ g_list_free_1 (GList *list)
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
g_list_free_full (GList *list,
|
g_list_free_full (GList *list,
|
||||||
GDestroyNotify free_func)
|
GDestroyNotify free_func)
|
||||||
{
|
{
|
||||||
while (list)
|
g_list_foreach (list, (GFunc) free_func, NULL);
|
||||||
{
|
g_list_free (list);
|
||||||
GList *next = list->next;
|
|
||||||
(*free_func) (list->data);
|
|
||||||
_g_list_free1 (list);
|
|
||||||
list = next;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -197,22 +197,17 @@ g_slist_free_1 (GSList *list)
|
|||||||
* @list: a pointer to a #GSList
|
* @list: a pointer to a #GSList
|
||||||
* @free_func: the function to be called to free each element's data
|
* @free_func: the function to be called to free each element's data
|
||||||
*
|
*
|
||||||
* Convenience method, which frees all the memory used by a #GSList,
|
* Convenience method, which frees all the memory used by a #GSList, and
|
||||||
* and calls the specified destroy function on every element's data.
|
* calls the specified destroy function on every element's data.
|
||||||
*
|
*
|
||||||
* Since: 2.28
|
* Since: 2.28
|
||||||
*/
|
**/
|
||||||
void
|
void
|
||||||
g_slist_free_full (GSList *list,
|
g_slist_free_full (GSList *list,
|
||||||
GDestroyNotify free_func)
|
GDestroyNotify free_func)
|
||||||
{
|
{
|
||||||
while (list)
|
g_slist_foreach (list, (GFunc) free_func, NULL);
|
||||||
{
|
g_slist_free (list);
|
||||||
GSList *next = list->next;
|
|
||||||
(*free_func) (list->data);
|
|
||||||
_g_slist_free1 (list);
|
|
||||||
list = next;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user