Blame glib/glib-autocleanups.h

Packit ae235b
/*
Packit ae235b
 * Copyright © 2015 Canonical Limited
Packit ae235b
 *
Packit ae235b
 * This library is free software; you can redistribute it and/or
Packit ae235b
 * modify it under the terms of the GNU Lesser General Public
Packit ae235b
 * License as published by the Free Software Foundation; either
Packit ae235b
 * version 2.1 of the License, or (at your option) any later version.
Packit ae235b
 *
Packit ae235b
 * This library is distributed in the hope that it will be useful,
Packit ae235b
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit ae235b
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit ae235b
 * Lesser General Public License for more details.
Packit ae235b
 *
Packit ae235b
 * You should have received a copy of the GNU Lesser General Public
Packit ae235b
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
Packit ae235b
 *
Packit ae235b
 * Author: Ryan Lortie <desrt@desrt.ca>
Packit ae235b
 */
Packit ae235b
Packit ae235b
#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
Packit ae235b
#error "Only <glib.h> can be included directly."
Packit ae235b
#endif
Packit ae235b
Packit ae235b
static inline void
Packit ae235b
g_autoptr_cleanup_generic_gfree (void *p)
Packit ae235b
{
Packit ae235b
  void **pp = (void**)p;
Packit ae235b
  g_free (*pp);
Packit ae235b
}
Packit ae235b
Packit ae235b
static inline void
Packit ae235b
g_autoptr_cleanup_gstring_free (GString *string)
Packit ae235b
{
Packit ae235b
  if (string)
Packit ae235b
    g_string_free (string, TRUE);
Packit ae235b
}
Packit ae235b
Packit ae235b
/* If adding a cleanup here, please also add a test case to
Packit ae235b
 * glib/tests/autoptr.c
Packit ae235b
 */
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GAsyncQueue, g_async_queue_unref)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GBookmarkFile, g_bookmark_file_free)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GBytes, g_bytes_unref)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GChecksum, g_checksum_free)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDateTime, g_date_time_unref)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDir, g_dir_close)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GError, g_error_free)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GHashTable, g_hash_table_unref)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GHmac, g_hmac_unref)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GIOChannel, g_io_channel_unref)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GKeyFile, g_key_file_unref)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GList, g_list_free)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GArray, g_array_unref)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GPtrArray, g_ptr_array_unref)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GByteArray, g_byte_array_unref)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMainContext, g_main_context_unref)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMainLoop, g_main_loop_unref)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSource, g_source_unref)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMappedFile, g_mapped_file_unref)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMarkupParseContext, g_markup_parse_context_unref)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GNode, g_node_destroy)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GOptionContext, g_option_context_free)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GOptionGroup, g_option_group_unref)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GPatternSpec, g_pattern_spec_free)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GQueue, g_queue_free)
Packit ae235b
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GQueue, g_queue_clear)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRand, g_rand_free)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRegex, g_regex_unref)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMatchInfo, g_match_info_unref)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GScanner, g_scanner_destroy)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSequence, g_sequence_free)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSList, g_slist_free)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GString, g_autoptr_cleanup_gstring_free)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GStringChunk, g_string_chunk_free)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GThread, g_thread_unref)
Packit ae235b
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GMutex, g_mutex_clear)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMutexLocker, g_mutex_locker_free)
Packit ae235b
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GCond, g_cond_clear)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTimer, g_timer_destroy)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTimeZone, g_time_zone_unref)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTree, g_tree_unref)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariant, g_variant_unref)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantBuilder, g_variant_builder_unref)
Packit ae235b
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GVariantBuilder, g_variant_builder_clear)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantIter, g_variant_iter_free)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantDict, g_variant_dict_unref)
Packit ae235b
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GVariantDict, g_variant_dict_clear)
Packit ae235b
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantType, g_variant_type_free)
Packit ae235b
G_DEFINE_AUTO_CLEANUP_FREE_FUNC(GStrv, g_strfreev, NULL)