2015-01-28 12:45:26 +01:00
|
|
|
|
/*
|
|
|
|
|
* Copyright © 2015 Canonical Limited
|
|
|
|
|
*
|
2022-05-18 10:15:38 +02:00
|
|
|
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
|
*
|
2015-01-28 12:45:26 +01:00
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
|
* License as published by the Free Software Foundation; either
|
2017-01-05 12:47:07 +01:00
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2015-01-28 12:45:26 +01:00
|
|
|
|
*
|
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*
|
|
|
|
|
* Author: Ryan Lortie <desrt@desrt.ca>
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
|
|
|
|
|
#error "Only <glib.h> can be included directly."
|
|
|
|
|
#endif
|
|
|
|
|
|
2015-02-15 14:58:44 +01:00
|
|
|
|
static inline void
|
|
|
|
|
g_autoptr_cleanup_generic_gfree (void *p)
|
2015-09-21 16:50:38 +02:00
|
|
|
|
{
|
2015-02-15 14:58:44 +01:00
|
|
|
|
void **pp = (void**)p;
|
2015-09-21 16:50:38 +02:00
|
|
|
|
g_free (*pp);
|
2015-02-15 14:58:44 +01:00
|
|
|
|
}
|
|
|
|
|
|
2015-09-10 14:08:35 +02:00
|
|
|
|
static inline void
|
|
|
|
|
g_autoptr_cleanup_gstring_free (GString *string)
|
|
|
|
|
{
|
|
|
|
|
if (string)
|
|
|
|
|
g_string_free (string, TRUE);
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-23 12:25:48 +02:00
|
|
|
|
/* Ignore deprecations in case we refer to a type which was added in a more
|
|
|
|
|
* recent GLib version than the user’s #GLIB_VERSION_MAX_ALLOWED definition. */
|
|
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
|
|
|
|
|
2015-02-23 14:32:36 +01:00
|
|
|
|
/* If adding a cleanup here, please also add a test case to
|
2015-09-10 14:08:35 +02:00
|
|
|
|
* glib/tests/autoptr.c
|
2015-02-23 14:32:36 +01:00
|
|
|
|
*/
|
2015-01-28 12:45:26 +01:00
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GAsyncQueue, g_async_queue_unref)
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GBookmarkFile, g_bookmark_file_free)
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GBytes, g_bytes_unref)
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GChecksum, g_checksum_free)
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDateTime, g_date_time_unref)
|
2019-11-27 17:07:06 +01:00
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDate, g_date_free)
|
2015-01-28 12:45:26 +01:00
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDir, g_dir_close)
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GError, g_error_free)
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GHashTable, g_hash_table_unref)
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GHmac, g_hmac_unref)
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GIOChannel, g_io_channel_unref)
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GKeyFile, g_key_file_unref)
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GList, g_list_free)
|
2015-02-20 00:31:29 +01:00
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GArray, g_array_unref)
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GPtrArray, g_ptr_array_unref)
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GByteArray, g_byte_array_unref)
|
2015-01-28 12:45:26 +01:00
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMainContext, g_main_context_unref)
|
2019-10-23 12:35:58 +02:00
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMainContextPusher, g_main_context_pusher_free)
|
2015-01-28 12:45:26 +01:00
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMainLoop, g_main_loop_unref)
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSource, g_source_unref)
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMappedFile, g_mapped_file_unref)
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMarkupParseContext, g_markup_parse_context_unref)
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GNode, g_node_destroy)
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GOptionContext, g_option_context_free)
|
2015-02-17 19:36:20 +01:00
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GOptionGroup, g_option_group_unref)
|
2015-01-28 12:45:26 +01:00
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GPatternSpec, g_pattern_spec_free)
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GQueue, g_queue_free)
|
|
|
|
|
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GQueue, g_queue_clear)
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRand, g_rand_free)
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRegex, g_regex_unref)
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMatchInfo, g_match_info_unref)
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GScanner, g_scanner_destroy)
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSequence, g_sequence_free)
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSList, g_slist_free)
|
2015-09-10 14:08:35 +02:00
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GString, g_autoptr_cleanup_gstring_free)
|
2015-01-28 12:45:26 +01:00
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GStringChunk, g_string_chunk_free)
|
2020-10-14 13:01:24 +02:00
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GStrvBuilder, g_strv_builder_unref)
|
2015-01-28 12:45:26 +01:00
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GThread, g_thread_unref)
|
|
|
|
|
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GMutex, g_mutex_clear)
|
2015-02-05 16:35:42 +01:00
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMutexLocker, g_mutex_locker_free)
|
2018-12-12 12:03:13 +01:00
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRecMutexLocker, g_rec_mutex_locker_free)
|
2019-05-09 16:27:47 +02:00
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRWLockWriterLocker, g_rw_lock_writer_locker_free)
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRWLockReaderLocker, g_rw_lock_reader_locker_free)
|
2015-01-28 12:45:26 +01:00
|
|
|
|
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GCond, g_cond_clear)
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTimer, g_timer_destroy)
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTimeZone, g_time_zone_unref)
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTree, g_tree_unref)
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariant, g_variant_unref)
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantBuilder, g_variant_builder_unref)
|
|
|
|
|
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GVariantBuilder, g_variant_builder_clear)
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantIter, g_variant_iter_free)
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantDict, g_variant_dict_unref)
|
|
|
|
|
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GVariantDict, g_variant_dict_clear)
|
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantType, g_variant_type_free)
|
2015-09-21 16:41:00 +02:00
|
|
|
|
G_DEFINE_AUTO_CLEANUP_FREE_FUNC(GStrv, g_strfreev, NULL)
|
2020-06-09 15:57:17 +02:00
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRefString, g_ref_string_release)
|
2019-01-17 07:38:20 +01:00
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUri, g_uri_unref)
|
2019-10-23 12:25:48 +02:00
|
|
|
|
|
|
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|