Blame libglnx/glnx-backport-autocleanups.h

rpm-build c487f7
/*
rpm-build c487f7
 * Copyright © 2015 Canonical Limited
rpm-build c487f7
 *
rpm-build c487f7
 * This library is free software; you can redistribute it and/or
rpm-build c487f7
 * modify it under the terms of the GNU Lesser General Public
rpm-build c487f7
 * License as published by the Free Software Foundation; either
rpm-build c487f7
 * version 2 of the licence, or (at your option) any later version.
rpm-build c487f7
 *
rpm-build c487f7
 * This library is distributed in the hope that it will be useful,
rpm-build c487f7
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
rpm-build c487f7
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
rpm-build c487f7
 * Lesser General Public License for more details.
rpm-build c487f7
 *
rpm-build c487f7
 * You should have received a copy of the GNU Lesser General Public
rpm-build c487f7
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
rpm-build c487f7
 *
rpm-build c487f7
 * Author: Ryan Lortie <desrt@desrt.ca>
rpm-build c487f7
 */
rpm-build c487f7
rpm-build c487f7
#pragma once
rpm-build c487f7
rpm-build c487f7
#include <glnx-backport-autoptr.h>
rpm-build c487f7
rpm-build c487f7
#if !GLIB_CHECK_VERSION(2, 43, 4)
rpm-build c487f7
rpm-build c487f7
static inline void
rpm-build c487f7
g_autoptr_cleanup_generic_gfree (void *p)
rpm-build c487f7
{ 
rpm-build c487f7
  void **pp = (void**)p;
rpm-build c487f7
  if (*pp)
rpm-build c487f7
    g_free (*pp);
rpm-build c487f7
}
rpm-build c487f7
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GAsyncQueue, g_async_queue_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GBookmarkFile, g_bookmark_file_free)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GBytes, g_bytes_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GChecksum, g_checksum_free)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDateTime, g_date_time_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDir, g_dir_close)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GError, g_error_free)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GHashTable, g_hash_table_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GHmac, g_hmac_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GIOChannel, g_io_channel_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GKeyFile, g_key_file_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GList, g_list_free)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GArray, g_array_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GPtrArray, g_ptr_array_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMainContext, g_main_context_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMainLoop, g_main_loop_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSource, g_source_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMappedFile, g_mapped_file_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMarkupParseContext, g_markup_parse_context_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(gchar, g_free)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GNode, g_node_destroy)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GOptionContext, g_option_context_free)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GOptionGroup, g_option_group_free)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GPatternSpec, g_pattern_spec_free)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GQueue, g_queue_free)
rpm-build c487f7
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GQueue, g_queue_clear)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRand, g_rand_free)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRegex, g_regex_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMatchInfo, g_match_info_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GScanner, g_scanner_destroy)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSequence, g_sequence_free)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSList, g_slist_free)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GStringChunk, g_string_chunk_free)
rpm-build c487f7
G_DEFINE_AUTO_CLEANUP_FREE_FUNC(GStrv, g_strfreev, NULL)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GThread, g_thread_unref)
rpm-build c487f7
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GMutex, g_mutex_clear)
rpm-build c487f7
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GCond, g_cond_clear)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTimer, g_timer_destroy)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTimeZone, g_time_zone_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTree, g_tree_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariant, g_variant_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantBuilder, g_variant_builder_unref)
rpm-build c487f7
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GVariantBuilder, g_variant_builder_clear)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantIter, g_variant_iter_free)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantDict, g_variant_dict_unref)
rpm-build c487f7
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GVariantDict, g_variant_dict_clear)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantType, g_variant_type_free)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSubprocess, g_object_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSubprocessLauncher, g_object_unref)
rpm-build c487f7
rpm-build c487f7
/* Add GObject-based types as needed. */
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GAsyncResult, g_object_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GCancellable, g_object_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GConverter, g_object_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GConverterOutputStream, g_object_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDataInputStream, g_object_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFile, g_object_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileEnumerator, g_object_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileIOStream, g_object_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileInfo, g_object_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileInputStream, g_object_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileMonitor, g_object_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileOutputStream, g_object_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GInputStream, g_object_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMemoryInputStream, g_object_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMemoryOutputStream, g_object_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMount, g_object_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GOutputStream, g_object_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSocket, g_object_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSocketAddress, g_object_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTask, g_object_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsCertificate, g_object_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsDatabase, g_object_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsInteraction, g_object_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusConnection, g_object_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusMessage, g_object_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVolumeMonitor, g_object_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GZlibCompressor, g_object_unref)
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GZlibDecompressor, g_object_unref)
rpm-build c487f7
rpm-build c487f7
#endif
rpm-build c487f7
rpm-build c487f7
#if !GLIB_CHECK_VERSION(2, 45, 8)
rpm-build c487f7
rpm-build c487f7
static inline void
rpm-build c487f7
g_autoptr_cleanup_gstring_free (GString *string)
rpm-build c487f7
{
rpm-build c487f7
  if (string)
rpm-build c487f7
    g_string_free (string, TRUE);
rpm-build c487f7
}
rpm-build c487f7
rpm-build c487f7
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GString, g_autoptr_cleanup_gstring_free)
rpm-build c487f7
rpm-build c487f7
#endif