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
This commit is contained in:
Colin Walters authored and Atomic Bot committed 2017-08-02 16:55:38 +00:00
1 parent ded6417aee
commit 40b41d2cc9
4 files changed
+17 -19

No files matched your search

+6 -8
View File
@@ -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