summaryrefslogtreecommitdiff
path: root/src/libostree/ostree-libarchive-private.h
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2017-07-31 13:28:16 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2017-08-02 16:55:38 +0000
commit40b41d2cc9cd541891f04f959beff59f19129d87 (patch)
treeed256e13550925314fb137a36a79f6ee77cc32e8 /src/libostree/ostree-libarchive-private.h
parentded6417aee906fad25a80fe5db85ee43b0552426 (diff)
downloadostree-40b41d2cc9cd541891f04f959beff59f19129d87.tar.gz
tree-wide: Use GLib autocleanups for libarchive
Define typedefs for read/write archives, and use the GLib autocleanups for them. Prep for updating libglnx to drop its custom autocleanup macros. Closes: #1042 Approved by: jlebon
Diffstat (limited to 'src/libostree/ostree-libarchive-private.h')
-rw-r--r--src/libostree/ostree-libarchive-private.h14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/libostree/ostree-libarchive-private.h b/src/libostree/ostree-libarchive-private.h
index 865a4b8d..dcf86ea3 100644
--- a/src/libostree/ostree-libarchive-private.h
+++ b/src/libostree/ostree-libarchive-private.h
@@ -22,6 +22,8 @@
#pragma once
+#include "config.h"
+
#include <gio/gio.h>
#include "libglnx.h"
#ifdef HAVE_LIBARCHIVE
@@ -32,14 +34,10 @@
G_BEGIN_DECLS
#ifdef HAVE_LIBARCHIVE
-GLNX_DEFINE_CLEANUP_FUNCTION (void *, flatpak_local_free_write_archive, archive_write_free)
-#define ot_cleanup_write_archive __attribute__((cleanup (flatpak_local_free_write_archive)))
-
-GLNX_DEFINE_CLEANUP_FUNCTION (void *, flatpak_local_free_read_archive, archive_read_free)
-#define ot_cleanup_read_archive __attribute__((cleanup (flatpak_local_free_read_archive)))
-#else
-#define ot_cleanup_write_archive
-#define ot_cleanup_read_archive
+typedef struct archive OtAutoArchiveWrite;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(OtAutoArchiveWrite, archive_write_free)
+typedef struct archive OtAutoArchiveRead;
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(OtAutoArchiveRead, archive_read_free)
#endif
G_END_DECLS