mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-22 03:02:06 +03:00
Use g_queue_free_full().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
c0abaa6508
commit
1ff4005228
@ -87,6 +87,27 @@ g_list_free_full (GList * list, GDestroyNotify free_func)
|
||||
g_list_free (list);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
#endif /* ! GLIB_CHECK_VERSION (2, 28, 0) */
|
||||
|
||||
#if ! GLIB_CHECK_VERSION (2, 32, 0)
|
||||
/**
|
||||
* g_queue_free_full:
|
||||
* @queue: a pointer to a #GQueue
|
||||
* @free_func: the function to be called to free each element's data
|
||||
*
|
||||
* Convenience method, which frees all the memory used by a #GQueue,
|
||||
* and calls the specified destroy function on every element's data.
|
||||
*
|
||||
* Since: 2.32
|
||||
*/
|
||||
void
|
||||
g_queue_free_full (GQueue * queue, GDestroyNotify free_func)
|
||||
{
|
||||
g_queue_foreach (queue, (GFunc) free_func, NULL);
|
||||
g_queue_free (queue);
|
||||
}
|
||||
#endif /* ! GLIB_CHECK_VERSION (2, 32, 0) */
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -16,6 +16,10 @@ void g_slist_free_full (GSList * list, GDestroyNotify free_func);
|
||||
void g_list_free_full (GList * list, GDestroyNotify free_func);
|
||||
#endif /* ! GLIB_CHECK_VERSION (2, 28, 0) */
|
||||
|
||||
#if ! GLIB_CHECK_VERSION (2, 32, 0)
|
||||
void g_queue_free_full (GQueue * queue, GDestroyNotify free_func);
|
||||
#endif /* ! GLIB_CHECK_VERSION (2, 32, 0) */
|
||||
|
||||
/*** inline functions ****************************************************************************/
|
||||
|
||||
#endif /* MC_GLIBCOMPAT_H */
|
||||
|
@ -759,11 +759,10 @@ listbox_remove_list (WListbox * l)
|
||||
{
|
||||
if (l->list != NULL)
|
||||
{
|
||||
g_queue_foreach (l->list, (GFunc) listbox_entry_free, NULL);
|
||||
g_queue_free (l->list);
|
||||
g_queue_free_full (l->list, (GDestroyNotify) listbox_entry_free);
|
||||
l->list = NULL;
|
||||
}
|
||||
|
||||
l->list = NULL;
|
||||
l->pos = l->top = 0;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user