Update translations from Transifex
[midnight-commander.git] / lib / glibcompat.c
blobd2ca0b6ebed7d363098a8f7baf9bb709eb5b58a8
1 /*
2 GLIB - Library of useful routines for C programming
4 Copyright (C) 2009-2019
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 /* --------------------------------------------------------------------------------------------- */
92 #endif /* ! GLIB_CHECK_VERSION (2, 28, 0) */
94 #if ! GLIB_CHECK_VERSION (2, 32, 0)
95 /**
96 * g_queue_free_full:
97 * @queue: a pointer to a #GQueue
98 * @free_func: the function to be called to free each element's data
100 * Convenience method, which frees all the memory used by a #GQueue,
101 * and calls the specified destroy function on every element's data.
103 * Since: 2.32
105 void
106 g_queue_free_full (GQueue * queue, GDestroyNotify free_func)
108 g_queue_foreach (queue, (GFunc) free_func, NULL);
109 g_queue_free (queue);
111 #endif /* ! GLIB_CHECK_VERSION (2, 32, 0) */
113 /* --------------------------------------------------------------------------------------------- */
115 #if ! GLIB_CHECK_VERSION (2, 60, 0)
117 * g_queue_clear_full:
118 * @queue: a pointer to a #GQueue
119 * @free_func: (nullable): the function to be called to free memory allocated
121 * Convenience method, which frees all the memory used by a #GQueue,
122 * and calls the provided @free_func on each item in the #GQueue.
124 * Since: 2.60
126 void
127 g_queue_clear_full (GQueue * queue, GDestroyNotify free_func)
129 g_return_if_fail (queue != NULL);
131 if (free_func != NULL)
132 g_queue_foreach (queue, (GFunc) free_func, NULL);
134 g_queue_clear (queue);
136 #endif /* ! GLIB_CHECK_VERSION (2, 60, 0) */
138 /* --------------------------------------------------------------------------------------------- */