mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
Use g_queue_clear_full().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
aa9d18e3ed
commit
7fb06b3105
@ -111,3 +111,28 @@ g_queue_free_full (GQueue * queue, GDestroyNotify free_func)
|
|||||||
#endif /* ! GLIB_CHECK_VERSION (2, 32, 0) */
|
#endif /* ! GLIB_CHECK_VERSION (2, 32, 0) */
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#if ! GLIB_CHECK_VERSION (2, 60, 0)
|
||||||
|
/**
|
||||||
|
* g_queue_clear_full:
|
||||||
|
* @queue: a pointer to a #GQueue
|
||||||
|
* @free_func: (nullable): the function to be called to free memory allocated
|
||||||
|
*
|
||||||
|
* Convenience method, which frees all the memory used by a #GQueue,
|
||||||
|
* and calls the provided @free_func on each item in the #GQueue.
|
||||||
|
*
|
||||||
|
* Since: 2.60
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
g_queue_clear_full (GQueue * queue, GDestroyNotify free_func)
|
||||||
|
{
|
||||||
|
g_return_if_fail (queue != NULL);
|
||||||
|
|
||||||
|
if (free_func != NULL)
|
||||||
|
g_queue_foreach (queue, (GFunc) free_func, NULL);
|
||||||
|
|
||||||
|
g_queue_clear (queue);
|
||||||
|
}
|
||||||
|
#endif /* ! GLIB_CHECK_VERSION (2, 60, 0) */
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
@ -20,6 +20,10 @@ void g_list_free_full (GList * list, GDestroyNotify free_func);
|
|||||||
void g_queue_free_full (GQueue * queue, GDestroyNotify free_func);
|
void g_queue_free_full (GQueue * queue, GDestroyNotify free_func);
|
||||||
#endif /* ! GLIB_CHECK_VERSION (2, 32, 0) */
|
#endif /* ! GLIB_CHECK_VERSION (2, 32, 0) */
|
||||||
|
|
||||||
|
#if ! GLIB_CHECK_VERSION (2, 60, 0)
|
||||||
|
void g_queue_clear_full (GQueue * queue, GDestroyNotify free_func);
|
||||||
|
#endif /* ! GLIB_CHECK_VERSION (2, 60, 0) */
|
||||||
|
|
||||||
/*** inline functions ****************************************************************************/
|
/*** inline functions ****************************************************************************/
|
||||||
|
|
||||||
#endif /* MC_GLIBCOMPAT_H */
|
#endif /* MC_GLIBCOMPAT_H */
|
||||||
|
@ -890,8 +890,7 @@ pop_directory (void)
|
|||||||
static void
|
static void
|
||||||
clear_stack (void)
|
clear_stack (void)
|
||||||
{
|
{
|
||||||
g_queue_foreach (&dir_queue, (GFunc) vfs_path_free, NULL);
|
g_queue_clear_full (&dir_queue, (GDestroyNotify) vfs_path_free);
|
||||||
g_queue_clear (&dir_queue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
Loading…
Reference in New Issue
Block a user