lib/gpg: Switch to GLib autocleanups for gpgme types
Prep for dropping `GLNX_DEFINE_CLEANUP_FUNCTION` from libglnx in favor of using GLib's `G_DEFINE_AUTO_CLEANUP_FREE_FUNC()`. Closes: #1042 Approved by: jlebon
This commit is contained in:
parent
6347c0fb88
commit
ded6417aee
|
|
@ -95,8 +95,8 @@ _ostree_gpg_verifier_check_signature (OstreeGpgVerifier *self,
|
|||
{
|
||||
GLNX_AUTO_PREFIX_ERROR("GPG", error);
|
||||
gpgme_error_t gpg_error = 0;
|
||||
ot_auto_gpgme_data gpgme_data_t data_buffer = NULL;
|
||||
ot_auto_gpgme_data gpgme_data_t signature_buffer = NULL;
|
||||
g_auto(gpgme_data_t) data_buffer = NULL;
|
||||
g_auto(gpgme_data_t) signature_buffer = NULL;
|
||||
g_autofree char *tmp_dir = NULL;
|
||||
g_autoptr(GOutputStream) target_stream = NULL;
|
||||
OstreeGpgVerifyResult *result = NULL;
|
||||
|
|
@ -165,7 +165,7 @@ _ostree_gpg_verifier_check_signature (OstreeGpgVerifier *self,
|
|||
{
|
||||
const char *path = self->key_ascii_files->pdata[i];
|
||||
glnx_fd_close int fd = -1;
|
||||
ot_auto_gpgme_data gpgme_data_t kdata = NULL;
|
||||
g_auto(gpgme_data_t) kdata = NULL;
|
||||
|
||||
if (!glnx_openat_rdonly (AT_FDCWD, path, TRUE, &fd, error))
|
||||
goto out;
|
||||
|
|
|
|||
|
|
@ -1331,9 +1331,9 @@ ostree_repo_remote_gpg_import (OstreeRepo *self,
|
|||
GError **error)
|
||||
{
|
||||
OstreeRemote *remote;
|
||||
ot_auto_gpgme_ctx gpgme_ctx_t source_context = NULL;
|
||||
ot_auto_gpgme_ctx gpgme_ctx_t target_context = NULL;
|
||||
ot_auto_gpgme_data gpgme_data_t data_buffer = NULL;
|
||||
g_auto(gpgme_ctx_t) source_context = NULL;
|
||||
g_auto(gpgme_ctx_t) target_context = NULL;
|
||||
g_auto(gpgme_data_t) data_buffer = NULL;
|
||||
gpgme_import_result_t import_result;
|
||||
gpgme_import_status_t import_status;
|
||||
g_autofree char *source_tmp_dir = NULL;
|
||||
|
|
|
|||
|
|
@ -413,7 +413,7 @@ ot_gpgme_new_ctx (const char *homedir,
|
|||
GError **error)
|
||||
{
|
||||
gpgme_error_t err;
|
||||
ot_auto_gpgme_ctx gpgme_ctx_t context = NULL;
|
||||
g_auto(gpgme_ctx_t) context = NULL;
|
||||
|
||||
if ((err = gpgme_new (&context)) != GPG_ERR_NO_ERROR)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26,10 +26,8 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GLNX_DEFINE_CLEANUP_FUNCTION0(gpgme_data_t, ot_cleanup_gpgme_data, gpgme_data_release)
|
||||
#define ot_auto_gpgme_data __attribute__((cleanup(ot_cleanup_gpgme_data)))
|
||||
GLNX_DEFINE_CLEANUP_FUNCTION0(gpgme_ctx_t, ot_cleanup_gpgme_ctx, gpgme_release)
|
||||
#define ot_auto_gpgme_ctx __attribute__((cleanup(ot_cleanup_gpgme_ctx)))
|
||||
G_DEFINE_AUTO_CLEANUP_FREE_FUNC(gpgme_data_t, gpgme_data_release, NULL);
|
||||
G_DEFINE_AUTO_CLEANUP_FREE_FUNC(gpgme_ctx_t, gpgme_release, NULL);
|
||||
|
||||
void ot_gpgme_error_to_gio_error (gpgme_error_t gpg_error, GError **error);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue