diff options
author | Simon McVittie <smcv@collabora.com> | 2019-05-01 18:24:22 +0100 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2019-11-11 18:32:06 +0000 |
commit | c8216c90ed8eedae574b01ac63449f6c9b3f7dda (patch) | |
tree | 7e563879a1fa10053beacb53d8680e62cd519f16 | |
parent | 46ba6b4187ea7e70caeef4bee144a932c6bf84ca (diff) | |
download | libglnx-c8216c90ed8eedae574b01ac63449f6c9b3f7dda.tar.gz |
backport-autocleanups: Hide autocleanups for types we don't have
If you're building on a really old GLib, you might not have GTask,
GSubprocess or g_markup_parse_context_unref(), among others. This gets
libglnx compiling (and apparently working) on GLib versions as old
as 2.32.
Signed-off-by: Simon McVittie <smcv@collabora.com>
-rw-r--r-- | glnx-backport-autocleanups.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/glnx-backport-autocleanups.h b/glnx-backport-autocleanups.h index b5f3475..50f469f 100644 --- a/glnx-backport-autocleanups.h +++ b/glnx-backport-autocleanups.h @@ -49,7 +49,9 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMainContext, g_main_context_unref) 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) +#if GLIB_CHECK_VERSION(2, 36, 0) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMarkupParseContext, g_markup_parse_context_unref) +#endif G_DEFINE_AUTOPTR_CLEANUP_FUNC(gchar, g_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GNode, g_node_destroy) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GOptionContext, g_option_context_free) @@ -75,11 +77,15 @@ 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) +#if GLIB_CHECK_VERSION(2, 40, 0) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantDict, g_variant_dict_unref) G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GVariantDict, g_variant_dict_clear) +#endif G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantType, g_variant_type_free) +#if GLIB_CHECK_VERSION(2, 40, 0) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSubprocess, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSubprocessLauncher, g_object_unref) +#endif /* Add GObject-based types as needed. */ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GAsyncResult, g_object_unref) @@ -101,7 +107,9 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMount, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GOutputStream, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSocket, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSocketAddress, g_object_unref) +#if GLIB_CHECK_VERSION(2, 36, 0) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTask, g_object_unref) +#endif G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsCertificate, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsDatabase, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsInteraction, g_object_unref) |