mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
Use g_slist_free_full().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
d0a082fbd5
commit
90dc6fffac
@ -96,3 +96,24 @@ g_strcmp0 (const char *str1, const char *str2)
|
||||
#endif /* ! GLIB_CHECK_VERSION (2, 16, 0) */
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
#if ! GLIB_CHECK_VERSION (2, 28, 0)
|
||||
/**
|
||||
* g_slist_free_full:
|
||||
* @list: a pointer to 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
|
||||
* calls the specified destroy function on every element's data.
|
||||
*
|
||||
* Since: 2.28
|
||||
**/
|
||||
void
|
||||
g_slist_free_full (GSList * list, GDestroyNotify free_func)
|
||||
{
|
||||
g_slist_foreach (list, (GFunc) free_func, NULL);
|
||||
g_slist_free (list);
|
||||
}
|
||||
#endif /* ! GLIB_CHECK_VERSION (2, 28, 0) */
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -19,6 +19,10 @@ gboolean g_unichar_iszerowidth (gunichar);
|
||||
int g_strcmp0 (const char *str1, const char *str2);
|
||||
#endif /* ! GLIB_CHECK_VERSION (2, 16, 0) */
|
||||
|
||||
#if ! GLIB_CHECK_VERSION (2, 28, 0)
|
||||
void g_slist_free_full (GSList * list, GDestroyNotify free_func);
|
||||
#endif /* ! GLIB_CHECK_VERSION (2, 28, 0) */
|
||||
|
||||
/*** inline functions ****************************************************************************/
|
||||
|
||||
#endif /* MC_GLIBCOMPAT_H */
|
||||
|
@ -1450,8 +1450,7 @@ edit_free_syntax_rules (WEdit * edit)
|
||||
MC_PTR_FREE (edit->rules[i]);
|
||||
}
|
||||
|
||||
g_slist_foreach (edit->syntax_marker, (GFunc) g_free, NULL);
|
||||
g_slist_free (edit->syntax_marker);
|
||||
g_slist_free_full (edit->syntax_marker, g_free);
|
||||
edit->syntax_marker = NULL;
|
||||
MC_PTR_FREE (edit->rules);
|
||||
tty_color_free_all_tmp ();
|
||||
|
@ -245,11 +245,10 @@ free_link (void *data)
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void *
|
||||
static inline void *
|
||||
free_linklist (GSList * lp)
|
||||
{
|
||||
g_slist_foreach (lp, (GFunc) free_link, NULL);
|
||||
g_slist_free (lp);
|
||||
g_slist_free_full (lp, free_link);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -394,8 +394,7 @@ end_link_area (int x, int y)
|
||||
static void
|
||||
clear_link_areas (void)
|
||||
{
|
||||
g_slist_foreach (link_area, (GFunc) g_free, NULL);
|
||||
g_slist_free (link_area);
|
||||
g_slist_free_full (link_area, g_free);
|
||||
link_area = NULL;
|
||||
inside_link_area = FALSE;
|
||||
}
|
||||
|
@ -205,8 +205,7 @@ cpio_free_archive (struct vfs_class *me, struct vfs_s_super *super)
|
||||
if (arch->fd != -1)
|
||||
mc_close (arch->fd);
|
||||
arch->fd = -1;
|
||||
g_slist_foreach (arch->deferred, (GFunc) g_free, NULL);
|
||||
g_slist_free (arch->deferred);
|
||||
g_slist_free_full (arch->deferred, g_free);
|
||||
arch->deferred = NULL;
|
||||
g_free (super->data);
|
||||
super->data = NULL;
|
||||
|
@ -2236,8 +2236,7 @@ ftpfs_done (struct vfs_class *me)
|
||||
{
|
||||
(void) me;
|
||||
|
||||
g_slist_foreach (no_proxy, (GFunc) g_free, NULL);
|
||||
g_slist_free (no_proxy);
|
||||
g_slist_free_full (no_proxy, g_free);
|
||||
|
||||
g_free (ftpfs_anonymous_passwd);
|
||||
g_free (ftpfs_proxy_host);
|
||||
|
Loading…
Reference in New Issue
Block a user