From 3ad5e444785b46b5b85bf06cc3650474f8d9521e Mon Sep 17 00:00:00 2001 From: Joursoir Date: Mon, 29 Aug 2022 19:46:00 +0300 Subject: r-gpgme: add macro to print gpgme specific error --- src/r-gpgme.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/r-gpgme.c b/src/r-gpgme.c index eed2db1..cfa2f98 100644 --- a/src/r-gpgme.c +++ b/src/r-gpgme.c @@ -27,6 +27,8 @@ #include "r-gpgme.h" #include "output.h" +#define print_gpgme_error(err) print_error("%s: %s\n", gpgme_strsource(err), gpgme_strerror(err)) + static void init_gpgme() { /* The GPGME library communicates with child processes (the @@ -60,7 +62,7 @@ static int init_ctx(gpgme_ctx_t ctx, gpgme_protocol_t protocol) return 0; error: - print_error("%s: %s\n", gpgme_strsource(err), gpgme_strerror(err)); + print_gpgme_error(err); return 1; } @@ -84,7 +86,7 @@ static int loop_read(const char *path, gpgme_data_t dh) out: if (ret != 0) { gpgme_error_t err = gpgme_err_code_from_errno(errno); - print_error("%s: %s\n", gpgme_strsource(err), gpgme_strerror(err)); + print_gpgme_error(err); } fclose(f); return ret; @@ -134,7 +136,7 @@ out_release_context: gpgme_release(ctx); out: if (err != GPG_ERR_NO_ERROR) { - print_error("%s: %s\n", gpgme_strsource(err), gpgme_strerror(err)); + print_gpgme_error(err); } return ret; } @@ -183,7 +185,7 @@ out_release_context: gpgme_release(ctx); out: if (err != GPG_ERR_NO_ERROR) { - print_error("%s: %s\n", gpgme_strsource(err), gpgme_strerror(err)); + print_gpgme_error(err); } return data; } -- cgit v1.2.3-18-g5258