summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2015-09-24 15:28:21 +0200
committerAlexander Larsson <alexl@redhat.com>2015-09-24 15:28:21 +0200
commit7310bbdb58379fa4e6d7ec99aa89c2b069814335 (patch)
tree8fb245ccc4f8965e11ea39f54f50f9a47b86ed86
parente684ef07f03dd563310788c90b3cdb00bac551eb (diff)
downloadlibglnx-7310bbdb58379fa4e6d7ec99aa89c2b069814335.tar.gz
Backport g_autoptr support for GString
-rw-r--r--glnx-backport-autocleanups.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/glnx-backport-autocleanups.h b/glnx-backport-autocleanups.h
index 472c865..f2bc483 100644
--- a/glnx-backport-autocleanups.h
+++ b/glnx-backport-autocleanups.h
@@ -31,6 +31,13 @@ g_autoptr_cleanup_generic_gfree (void *p)
g_free (*pp);
}
+static inline void
+g_autoptr_cleanup_gstring_free (GString *string)
+{
+ if (string)
+ g_string_free (string, TRUE);
+}
+
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)
@@ -48,6 +55,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GPtrArray, g_ptr_array_unref)
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(GString, g_autoptr_cleanup_gstring_free)
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(gchar, g_free)