mirror of
https://github.com/flatpak/flatpak.git
synced 2026-03-27 19:33:06 -04:00
backports: g_autofree
This commit is contained in:
@@ -21,7 +21,15 @@
|
||||
|
||||
#include <glnx-backport-autoptr.h>
|
||||
|
||||
#if !GLIB_CHECK_VERSION(2, 43, 3)
|
||||
#if !GLIB_CHECK_VERSION(2, 43, 4)
|
||||
|
||||
static inline void
|
||||
g_autoptr_cleanup_generic_gfree (void *p)
|
||||
{
|
||||
void **pp = (void**)p;
|
||||
if (*pp)
|
||||
g_free (*pp);
|
||||
}
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GAsyncQueue, g_async_queue_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GBookmarkFile, g_bookmark_file_free)
|
||||
|
||||
@@ -55,6 +55,7 @@ G_BEGIN_DECLS
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
#define g_autoptr(TypeName) _GLIB_CLEANUP(_GLIB_AUTOPTR_FUNC_NAME(TypeName)) _GLIB_AUTOPTR_TYPENAME(TypeName)
|
||||
#define g_auto(TypeName) _GLIB_CLEANUP(_GLIB_AUTO_FUNC_NAME(TypeName)) TypeName
|
||||
#define g_autofree _GLIB_CLEANUP(g_autoptr_cleanup_generic_gfree)
|
||||
|
||||
/**
|
||||
* g_steal_pointer:
|
||||
|
||||
Reference in New Issue
Block a user