Merge branch '3607_cleanup'
[midnight-commander.git] / lib / glibcompat.c
blobbdcb82174d5e6fb0984a5ae5a5a15107c10e099d
1 /*
2 GLIB - Library of useful routines for C programming
4 Copyright (C) 2009-2016
5 Free Software Foundation, Inc.
7 Written by:
8 Slava Zanko <slavazanko@gmail.com>, 2009, 2013.
10 This file is part of the Midnight Commander.
12 The Midnight Commander is free software: you can redistribute it
13 and/or modify it under the terms of the GNU General Public License as
14 published by the Free Software Foundation, either version 3 of the License,
15 or (at your option) any later version.
17 The Midnight Commander is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program. If not, see <http://www.gnu.org/licenses/>.
26 /** \file glibcompat.c
27 * \brief Source: compatibility with older versions of glib
29 * Following code was copied from glib to GNU Midnight Commander to
30 * provide compatibility with older versions of glib.
33 #include <config.h>
34 #include <string.h>
36 #include "global.h"
37 #include "glibcompat.h"
39 /*** global variables ****************************************************************************/
41 /*** file scope macro definitions ****************************************************************/
43 /*** file scope type declarations ****************************************************************/
45 /*** file scope variables ************************************************************************/
47 /*** file scope functions ************************************************************************/
49 /* --------------------------------------------------------------------------------------------- */
50 /*** public functions ****************************************************************************/
51 /* --------------------------------------------------------------------------------------------- */
53 #if ! GLIB_CHECK_VERSION (2, 28, 0)
54 /**
55 * g_slist_free_full:
56 * @list: a pointer to a #GSList
57 * @free_func: the function to be called to free each element's data
59 * Convenience method, which frees all the memory used by a #GSList, and
60 * calls the specified destroy function on every element's data.
62 * Since: 2.28
63 **/
64 void
65 g_slist_free_full (GSList * list, GDestroyNotify free_func)
67 g_slist_foreach (list, (GFunc) free_func, NULL);
68 g_slist_free (list);
71 /* --------------------------------------------------------------------------------------------- */
73 /**
74 * g_list_free_full:
75 * @list: a pointer to a #GList
76 * @free_func: the function to be called to free each element's data
78 * Convenience method, which frees all the memory used by a #GList, and
79 * calls the specified destroy function on every element's data.
81 * Since: 2.28
83 void
84 g_list_free_full (GList * list, GDestroyNotify free_func)
86 g_list_foreach (list, (GFunc) free_func, NULL);
87 g_list_free (list);
90 #endif /* ! GLIB_CHECK_VERSION (2, 28, 0) */
92 /* --------------------------------------------------------------------------------------------- */