From 5857491a2aa7d4975100d90f1ad62c08aa345e3e Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Fri, 16 Nov 2018 16:25:49 +0100 Subject: [PATCH] core: Simplify the trace maros by using variadics. * src/debug.h (TRACE_BEG, TRACE_LOG, TRACE_SUC): Use variadic macros and remove the TRACE_BEG1 et al. Change all users to always pass a format string. (TRACE): Ditto. * src/debug.c (_gpgme_debugf): New. * configure.ac : Add -Wno-format-zero-length. -- This makes it easier for use to enable format checks. The zero-length format is required to allow for an empty format due to the comman problematic of __VA_ARGS__. Signed-off-by: Werner Koch --- configure.ac | 1 + src/data-compat.c | 14 ++-- src/data-estream.c | 4 +- src/data-fd.c | 4 +- src/data-mem.c | 16 ++-- src/data-stream.c | 4 +- src/data-user.c | 4 +- src/data.c | 34 ++++---- src/debug.c | 85 +++++++++++++++++++ src/debug.h | 163 +++++++----------------------------- src/decrypt-verify.c | 8 +- src/decrypt.c | 18 ++-- src/delete.c | 8 +- src/edit.c | 12 +-- src/encrypt-sign.c | 12 +-- src/encrypt.c | 20 ++--- src/engine-assuan.c | 18 ++-- src/engine-g13.c | 14 ++-- src/engine-gpg.c | 6 +- src/engine-gpgsm.c | 16 ++-- src/engine-spawn.c | 2 +- src/engine-uiserver.c | 16 ++-- src/export.c | 20 ++--- src/genkey.c | 30 +++---- src/getauditlog.c | 4 +- src/gpgme.c | 92 ++++++++++----------- src/import.c | 28 +++---- src/keylist.c | 26 +++--- src/keysign.c | 4 +- src/opassuan.c | 18 ++-- src/passwd.c | 4 +- src/posix-io.c | 46 +++++------ src/queryswdb.c | 10 +-- src/sign.c | 22 ++--- src/signers.c | 6 +- src/spawn.c | 4 +- src/tofupolicy.c | 4 +- src/trustlist.c | 12 +-- src/verify.c | 20 ++--- src/version.c | 6 +- src/vfs-create.c | 4 +- src/vfs-mount.c | 2 +- src/w32-glib-io.c | 74 ++++++++--------- src/w32-io.c | 186 +++++++++++++++++++++--------------------- src/w32-util.c | 10 +-- src/wait.c | 8 +- 46 files changed, 550 insertions(+), 569 deletions(-) diff --git a/configure.ac b/configure.ac index b4223e9a..1b607e0b 100644 --- a/configure.ac +++ b/configure.ac @@ -581,6 +581,7 @@ if test "$GCC" = yes; then CFLAGS="$CFLAGS -Wdeclaration-after-statement" CFLAGS="$CFLAGS -Wno-missing-field-initializers" CFLAGS="$CFLAGS -Wno-sign-compare" + CFLAGS="$CFLAGS -Wno-format-zero-length" fi CXXFLAGS="$CXXFLAGS -Wall -Wextra -Wno-shadow" diff --git a/src/data-compat.c b/src/data-compat.c index a929f0b8..830b42c6 100644 --- a/src/data-compat.c +++ b/src/data-compat.c @@ -47,7 +47,7 @@ gpgme_data_new_from_filepart (gpgme_data_t *r_dh, const char *fname, char *buf = NULL; int res; - TRACE_BEG4 (DEBUG_DATA, "gpgme_data_new_from_filepart", r_dh, + TRACE_BEG (DEBUG_DATA, "gpgme_data_new_from_filepart", r_dh, "file_name=%s, stream=%p, offset=%lli, length=%u", fname, stream, offset, length); @@ -110,7 +110,7 @@ gpgme_data_new_from_filepart (gpgme_data_t *r_dh, const char *fname, (*r_dh)->data.mem.size = length; (*r_dh)->data.mem.length = length; - return TRACE_SUC1 ("r_dh=%p", *r_dh); + return TRACE_SUC ("r_dh=%p", *r_dh); } @@ -121,7 +121,7 @@ gpgme_data_new_from_file (gpgme_data_t *r_dh, const char *fname, int copy) { gpgme_error_t err; struct stat statbuf; - TRACE_BEG3 (DEBUG_DATA, "gpgme_data_new_from_file", r_dh, + TRACE_BEG (DEBUG_DATA, "gpgme_data_new_from_file", r_dh, "file_name=%s, copy=%i (%s)", fname, copy, copy ? "yes" : "no"); if (!fname || !copy) @@ -159,7 +159,7 @@ gpgme_error_to_errno (gpgme_error_t err) break; } } - TRACE3 (DEBUG_DATA, "gpgme:gpgme_error_to_errno", 0, + TRACE (DEBUG_DATA, "gpgme:gpgme_error_to_errno", 0, "mapping %s <%s> to: %s", gpgme_strerror (err), gpgme_strsource (err), strerror (res)); gpg_err_set_errno (res); @@ -172,7 +172,7 @@ old_user_read (gpgme_data_t dh, void *buffer, size_t size) { gpgme_error_t err; size_t amt; - TRACE_BEG2 (DEBUG_DATA, "gpgme:old_user_read", dh, + TRACE_BEG (DEBUG_DATA, "gpgme:old_user_read", dh, "buffer=%p, size=%u", buffer, size); err = (*dh->data.old_user.cb) (dh->data.old_user.handle, @@ -187,7 +187,7 @@ static gpgme_off_t old_user_seek (gpgme_data_t dh, gpgme_off_t offset, int whence) { gpgme_error_t err; - TRACE_BEG2 (DEBUG_DATA, "gpgme:old_user_seek", dh, + TRACE_BEG (DEBUG_DATA, "gpgme:old_user_seek", dh, "offset=%llu, whence=%i", offset, whence); if (whence != SEEK_SET || offset) @@ -219,7 +219,7 @@ gpgme_data_new_with_read_cb (gpgme_data_t *r_dh, void *read_cb_value) { gpgme_error_t err; - TRACE_BEG2 (DEBUG_DATA, "gpgme_data_new_with_read_cb", r_dh, + TRACE_BEG (DEBUG_DATA, "gpgme_data_new_with_read_cb", r_dh, "read_cb=%p/%p", read_cb, read_cb_value); err = _gpgme_data_new (r_dh, &old_user_cbs); diff --git a/src/data-estream.c b/src/data-estream.c index fa11d664..1f1a64eb 100644 --- a/src/data-estream.c +++ b/src/data-estream.c @@ -87,7 +87,7 @@ gpgme_error_t gpgme_data_new_from_estream (gpgme_data_t *r_dh, gpgrt_stream_t stream) { gpgme_error_t err; - TRACE_BEG1 (DEBUG_DATA, "gpgme_data_new_from_estream", r_dh, "estream=%p", + TRACE_BEG (DEBUG_DATA, "gpgme_data_new_from_estream", r_dh, "estream=%p", stream); err = _gpgme_data_new (r_dh, &stream_es_cbs); @@ -95,5 +95,5 @@ gpgme_data_new_from_estream (gpgme_data_t *r_dh, gpgrt_stream_t stream) return TRACE_ERR (err); (*r_dh)->data.e_stream = stream; - return TRACE_SUC1 ("dh=%p", *r_dh); + return TRACE_SUC ("dh=%p", *r_dh); } diff --git a/src/data-fd.c b/src/data-fd.c index b8739f2c..6a915fc0 100644 --- a/src/data-fd.c +++ b/src/data-fd.c @@ -75,12 +75,12 @@ gpgme_error_t gpgme_data_new_from_fd (gpgme_data_t *r_dh, int fd) { gpgme_error_t err; - TRACE_BEG1 (DEBUG_DATA, "gpgme_data_new_from_fd", r_dh, "fd=0x%x", fd); + TRACE_BEG (DEBUG_DATA, "gpgme_data_new_from_fd", r_dh, "fd=0x%x", fd); err = _gpgme_data_new (r_dh, &fd_cbs); if (err) return TRACE_ERR (err); (*r_dh)->data.fd = fd; - return TRACE_SUC1 ("dh=%p", *r_dh); + return TRACE_SUC ("dh=%p", *r_dh); } diff --git a/src/data-mem.c b/src/data-mem.c index 2d19a99c..c461a606 100644 --- a/src/data-mem.c +++ b/src/data-mem.c @@ -170,14 +170,14 @@ gpgme_error_t gpgme_data_new (gpgme_data_t *r_dh) { gpgme_error_t err; - TRACE_BEG (DEBUG_DATA, "gpgme_data_new", r_dh); + TRACE_BEG (DEBUG_DATA, "gpgme_data_new", r_dh, ""); err = _gpgme_data_new (r_dh, &mem_cbs); if (err) return TRACE_ERR (err); - return TRACE_SUC1 ("dh=%p", *r_dh); + return TRACE_SUC ("dh=%p", *r_dh); } @@ -189,7 +189,7 @@ gpgme_data_new_from_mem (gpgme_data_t *r_dh, const char *buffer, size_t size, int copy) { gpgme_error_t err; - TRACE_BEG4 (DEBUG_DATA, "gpgme_data_new_from_mem", r_dh, + TRACE_BEG (DEBUG_DATA, "gpgme_data_new_from_mem", r_dh, "buffer=%p, size=%u, copy=%i (%s)", buffer, size, copy, copy ? "yes" : "no"); @@ -214,7 +214,7 @@ gpgme_data_new_from_mem (gpgme_data_t *r_dh, const char *buffer, (*r_dh)->data.mem.size = size; (*r_dh)->data.mem.length = size; - return TRACE_SUC1 ("dh=%p", *r_dh); + return TRACE_SUC ("dh=%p", *r_dh); } @@ -229,7 +229,7 @@ gpgme_data_release_and_get_mem (gpgme_data_t dh, size_t *r_len) size_t len; int blankout; - TRACE_BEG1 (DEBUG_DATA, "gpgme_data_release_and_get_mem", dh, + TRACE_BEG (DEBUG_DATA, "gpgme_data_release_and_get_mem", dh, "r_len=%p", r_len); if (!dh || dh->cbs != &mem_cbs) @@ -283,11 +283,11 @@ gpgme_data_release_and_get_mem (gpgme_data_t dh, size_t *r_len) if (r_len) { - TRACE_SUC2 ("buffer=%p, len=%u", str, *r_len); + TRACE_SUC ("buffer=%p, len=%u", str, *r_len); } else { - TRACE_SUC1 ("buffer=%p", str); + TRACE_SUC ("buffer=%p", str); } return str; } @@ -298,7 +298,7 @@ gpgme_data_release_and_get_mem (gpgme_data_t dh, size_t *r_len) void gpgme_free (void *buffer) { - TRACE (DEBUG_DATA, "gpgme_free", buffer); + TRACE (DEBUG_DATA, "gpgme_free", buffer, ""); if (buffer) free (buffer); diff --git a/src/data-stream.c b/src/data-stream.c index 8961d079..19a5a079 100644 --- a/src/data-stream.c +++ b/src/data-stream.c @@ -96,7 +96,7 @@ gpgme_error_t gpgme_data_new_from_stream (gpgme_data_t *r_dh, FILE *stream) { gpgme_error_t err; - TRACE_BEG1 (DEBUG_DATA, "gpgme_data_new_from_stream", r_dh, "stream=%p", + TRACE_BEG (DEBUG_DATA, "gpgme_data_new_from_stream", r_dh, "stream=%p", stream); err = _gpgme_data_new (r_dh, &stream_cbs); @@ -104,5 +104,5 @@ gpgme_data_new_from_stream (gpgme_data_t *r_dh, FILE *stream) return TRACE_ERR (err); (*r_dh)->data.stream = stream; - return TRACE_SUC1 ("dh=%p", *r_dh); + return TRACE_SUC ("dh=%p", *r_dh); } diff --git a/src/data-user.c b/src/data-user.c index d1d85250..f5bd2efb 100644 --- a/src/data-user.c +++ b/src/data-user.c @@ -92,7 +92,7 @@ gpgme_error_t gpgme_data_new_from_cbs (gpgme_data_t *r_dh, gpgme_data_cbs_t cbs, void *handle) { gpgme_error_t err; - TRACE_BEG1 (DEBUG_DATA, "gpgme_data_new_from_cbs", r_dh, "handle=%p", handle); + TRACE_BEG (DEBUG_DATA, "gpgme_data_new_from_cbs", r_dh, "handle=%p", handle); err = _gpgme_data_new (r_dh, &user_cbs); if (err) @@ -100,5 +100,5 @@ gpgme_data_new_from_cbs (gpgme_data_t *r_dh, gpgme_data_cbs_t cbs, void *handle) (*r_dh)->data.user.cbs = cbs; (*r_dh)->data.user.handle = handle; - return TRACE_SUC1 ("dh=%p", *r_dh); + return TRACE_SUC ("dh=%p", *r_dh); } diff --git a/src/data.c b/src/data.c index a786c7c7..f633e08c 100644 --- a/src/data.c +++ b/src/data.c @@ -178,7 +178,7 @@ _gpgme_data_set_prop (gpgme_data_t dh, uint64_t dserial, { gpg_error_t err = 0; int idx; - TRACE_BEG3 (DEBUG_DATA, "gpgme_data_set_prop", dh, + TRACE_BEG (DEBUG_DATA, "gpgme_data_set_prop", dh, "dserial=%llu %lu=%d", (unsigned long long)dserial, (unsigned long)name, value); @@ -241,7 +241,7 @@ _gpgme_data_get_prop (gpgme_data_t dh, uint64_t dserial, { gpg_error_t err = 0; int idx; - TRACE_BEG2 (DEBUG_DATA, "gpgme_data_get_prop", dh, + TRACE_BEG (DEBUG_DATA, "gpgme_data_get_prop", dh, "dserial=%llu %lu", (unsigned long long)dserial, (unsigned long)name); @@ -352,7 +352,7 @@ gpgme_data_read (gpgme_data_t dh, void *buffer, size_t size) { gpgme_ssize_t res; int blankout; - TRACE_BEG2 (DEBUG_DATA, "gpgme_data_read", dh, + TRACE_BEG (DEBUG_DATA, "gpgme_data_read", dh, "buffer=%p, size=%u", buffer, size); if (!dh) @@ -387,7 +387,7 @@ gpgme_ssize_t gpgme_data_write (gpgme_data_t dh, const void *buffer, size_t size) { gpgme_ssize_t res; - TRACE_BEG2 (DEBUG_DATA, "gpgme_data_write", dh, + TRACE_BEG (DEBUG_DATA, "gpgme_data_write", dh, "buffer=%p, size=%u", buffer, size); if (!dh) @@ -414,7 +414,7 @@ gpgme_data_write (gpgme_data_t dh, const void *buffer, size_t size) gpgme_off_t gpgme_data_seek (gpgme_data_t dh, gpgme_off_t offset, int whence) { - TRACE_BEG2 (DEBUG_DATA, "gpgme_data_seek", dh, + TRACE_BEG (DEBUG_DATA, "gpgme_data_seek", dh, "offset=%lli, whence=%i", offset, whence); if (!dh) @@ -446,7 +446,7 @@ gpgme_error_t gpgme_data_rewind (gpgme_data_t dh) { gpgme_error_t err; - TRACE_BEG (DEBUG_DATA, "gpgme_data_rewind", dh); + TRACE_BEG (DEBUG_DATA, "gpgme_data_rewind", dh, ""); err = ((gpgme_data_seek (dh, 0, SEEK_SET) == -1) ? gpg_error_from_syserror () : 0); @@ -459,7 +459,7 @@ gpgme_data_rewind (gpgme_data_t dh) void gpgme_data_release (gpgme_data_t dh) { - TRACE (DEBUG_DATA, "gpgme_data_release", dh); + TRACE (DEBUG_DATA, "gpgme_data_release", dh, ""); if (!dh) return; @@ -475,8 +475,8 @@ gpgme_data_release (gpgme_data_t dh) gpgme_data_encoding_t gpgme_data_get_encoding (gpgme_data_t dh) { - TRACE1 (DEBUG_DATA, "gpgme_data_get_encoding", dh, - "dh->encoding=%i", dh ? dh->encoding : GPGME_DATA_ENCODING_NONE); + TRACE (DEBUG_DATA, "gpgme_data_get_encoding", dh, + "dh->encoding=%i", dh ? dh->encoding : GPGME_DATA_ENCODING_NONE); return dh ? dh->encoding : GPGME_DATA_ENCODING_NONE; } @@ -486,7 +486,7 @@ gpgme_data_get_encoding (gpgme_data_t dh) gpgme_error_t gpgme_data_set_encoding (gpgme_data_t dh, gpgme_data_encoding_t enc) { - TRACE_BEG1 (DEBUG_DATA, "gpgme_data_set_encoding", dh, + TRACE_BEG (DEBUG_DATA, "gpgme_data_set_encoding", dh, "encoding=%i", enc); if (!dh) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); @@ -502,7 +502,7 @@ gpgme_data_set_encoding (gpgme_data_t dh, gpgme_data_encoding_t enc) gpgme_error_t gpgme_data_set_file_name (gpgme_data_t dh, const char *file_name) { - TRACE_BEG1 (DEBUG_DATA, "gpgme_data_set_file_name", dh, + TRACE_BEG (DEBUG_DATA, "gpgme_data_set_file_name", dh, "file_name=%s", file_name); if (!dh) @@ -531,12 +531,12 @@ gpgme_data_get_file_name (gpgme_data_t dh) { if (!dh) { - TRACE (DEBUG_DATA, "gpgme_data_get_file_name", dh); + TRACE (DEBUG_DATA, "gpgme_data_get_file_name", dh, ""); return NULL; } - TRACE1 (DEBUG_DATA, "gpgme_data_get_file_name", dh, - "dh->file_name=%s", dh->file_name); + TRACE (DEBUG_DATA, "gpgme_data_get_file_name", dh, + "dh->file_name=%s", dh->file_name); return dh->file_name; } @@ -545,7 +545,7 @@ gpgme_data_get_file_name (gpgme_data_t dh) gpg_error_t gpgme_data_set_flag (gpgme_data_t dh, const char *name, const char *value) { - TRACE_BEG2 (DEBUG_DATA, "gpgme_data_set_flag", dh, + TRACE_BEG (DEBUG_DATA, "gpgme_data_set_flag", dh, "%s=%s", name, value); if (!dh) @@ -573,7 +573,7 @@ _gpgme_data_inbound_handler (void *opaque, int fd) char buffer[BUFFER_SIZE]; char *bufp = buffer; gpgme_ssize_t buflen; - TRACE_BEG1 (DEBUG_CTX, "_gpgme_data_inbound_handler", dh, + TRACE_BEG (DEBUG_CTX, "_gpgme_data_inbound_handler", dh, "fd=0x%x", fd); buflen = _gpgme_io_read (fd, buffer, BUFFER_SIZE); @@ -604,7 +604,7 @@ _gpgme_data_outbound_handler (void *opaque, int fd) struct io_cb_data *data = (struct io_cb_data *) opaque; gpgme_data_t dh = (gpgme_data_t) data->handler_value; gpgme_ssize_t nwritten; - TRACE_BEG1 (DEBUG_CTX, "_gpgme_data_outbound_handler", dh, + TRACE_BEG (DEBUG_CTX, "_gpgme_data_outbound_handler", dh, "fd=0x%x", fd); if (!dh->pending_len) diff --git a/src/debug.c b/src/debug.c index 364a5767..a2f0e694 100644 --- a/src/debug.c +++ b/src/debug.c @@ -282,6 +282,91 @@ _gpgme_debug (int level, const char *format, ...) return 0; } +/* Log the formatted string FORMAT prefixed with additional info + * depending on MODE: + * + * -1 = Do not print any additional args. + * 0 = standalone (used by macro TRACE) + * 1 = enter a function (used by macro TRACE_BEG) + * 2 = debug a function (used by macro TRACE_LOG) + * 3 = leave a function (used by macro TRACE_SUC) + * + * Returns: 0 + * + * Note that we always return 0 because the old TRACE macro evaluated + * to 0 which issues a warning with newer gcc version about an unused + * values. By using a return value of this function this can be + * avoided. Fixme: It might be useful to check whether the return + * value from the TRACE macros are actually used somewhere. + */ +int +_gpgme_debugf (int level, int mode, const char *func, const char *tagname, + const char *tagvalue, const char *format, ...) +{ + va_list arg_ptr; + int saved_errno; + + saved_errno = errno; + if (debug_level < level) + return 0; + + va_start (arg_ptr, format); + LOCK (debug_lock); + { + struct tm *tp; + time_t atime = time (NULL); + + tp = localtime (&atime); + fprintf (errfp, "GPGME %04d-%02d-%02d %02d:%02d:%02d <0x%04llx> ", + 1900+tp->tm_year, tp->tm_mon+1, tp->tm_mday, + tp->tm_hour, tp->tm_min, tp->tm_sec, + (unsigned long long) ath_self ()); + } +#ifdef FRAME_NR + { + int indent; + + indent = frame_nr > 0? (2 * (frame_nr - 1)):0; + fprintf (errfp, "%*s", indent < 40? indent : 40, ""); + } +#endif + + switch (mode) + { + case -1: /* Do nothing. */ + break; + case 0: + fprintf (errfp, "%s: call: %s=%p ", func, tagname, tagvalue); + break; + case 1: + fprintf (errfp, "%s: enter: %s=%p ", func, tagname, tagvalue); + break; + case 2: + fprintf (errfp, "%s: check: %s=%p ", func, tagname, tagvalue); + break; + case 3: + if (tagname) + fprintf (errfp, "%s: leave: %s=%p ", func, tagname, tagvalue); + else + fprintf (errfp, "%s: leave: ", func); + break; + default: + fprintf (errfp, "%s: m=%d: %s=%p ", func, mode, tagname, tagvalue); + break; + } + + vfprintf (errfp, format, arg_ptr); + va_end (arg_ptr); + if(format && *format && format[strlen (format) - 1] != '\n') + putc ('\n', errfp); + UNLOCK (debug_lock); + fflush (errfp); + + gpg_err_set_errno (saved_errno); + return 0; +} + + /* Start a new debug line in *LINE, logged at level LEVEL or higher, and starting with the formatted string FORMAT. */ diff --git a/src/debug.h b/src/debug.h index 77fec559..9f9fd5df 100644 --- a/src/debug.h +++ b/src/debug.h @@ -69,6 +69,10 @@ void _gpgme_debug_subsystem_init (void); /* Log the formatted string FORMAT at debug level LEVEL or higher. */ int _gpgme_debug (int level, const char *format, ...); +int _gpgme_debugf (int level, int mode, + const char *func, const char *tagname, const char *tagvalue, + const char *format, ...) GPGRT_ATTR_PRINTF(6,7); + /* Start a new debug line in *LINE, logged at level LEVEL or higher, and starting with the formatted string FORMAT. */ @@ -109,160 +113,51 @@ _gpgme_trace_gpgme_error (gpgme_error_t err, const char *file, int line) void *_gpgme_trace_tag = (void *) (uintptr_t) tag; \ _gpgme_debug_frame_begin () -#define TRACE_BEG(lvl, name, tag) \ - _TRACE (lvl, name, tag); \ - _gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p\n", \ - _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag) -#define TRACE_BEG0(lvl, name, tag, fmt) \ +#define TRACE_BEG(lvl, name, tag, ...) \ _TRACE (lvl, name, tag); \ - _gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \ - _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag) -#define TRACE_BEG1(lvl, name, tag, fmt, arg1) \ - _TRACE (lvl, name, tag); \ - _gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \ - _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \ - arg1) -#define TRACE_BEG2(lvl, name, tag, fmt, arg1, arg2) \ - _TRACE (lvl, name, tag); \ - _gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \ - _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \ - arg1, arg2) -#define TRACE_BEG3(lvl, name, tag, fmt, arg1, arg2, arg3) \ - _TRACE (lvl, name, tag); \ - _gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \ - _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \ - arg1, arg2, arg3) -#define TRACE_BEG4(lvl, name, tag, fmt, arg1, arg2, arg3, arg4) \ - _TRACE (lvl, name, tag); \ - _gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \ - _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \ - arg1, arg2, arg3, arg4) -#define TRACE_BEG5(lvl, name, tag, fmt, arg1, arg2, arg3, arg4, arg5) \ - _TRACE (lvl, name, tag); \ - _gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \ - _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \ - arg1, arg2, arg3, arg4, arg5) -#define TRACE_BEG7(lvl, name, tag, fmt, arg1, arg2, arg3, arg4, \ - arg5, arg6, arg7) \ - _TRACE (lvl, name, tag); \ - _gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \ - _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \ - arg1, arg2, arg3, arg4, arg5, arg6, arg7) -#define TRACE_BEG8(lvl, name, tag, fmt, arg1, arg2, arg3, arg4, \ - arg5, arg6, arg7, arg8) \ - _TRACE (lvl, name, tag); \ - _gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \ - _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \ - arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) + _gpgme_debugf (_gpgme_trace_level, 1, \ + _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \ + __VA_ARGS__) -#define TRACE(lvl, name, tag) \ +#define TRACE(lvl, name, tag, ...) \ _gpgme_debug_frame_begin (), \ - _gpgme_debug (lvl, "%s: call: %s=%p\n", \ - name, STRINGIFY (tag), (void *) (uintptr_t) tag), \ - _gpgme_debug_frame_end () -#define TRACE0(lvl, name, tag, fmt) \ - _gpgme_debug_frame_begin (), \ - _gpgme_debug (lvl, "%s: call: %s=%p, " fmt "\n", \ - name, STRINGIFY (tag), (void *) (uintptr_t) tag), \ - _gpgme_debug_frame_end () -#define TRACE1(lvl, name, tag, fmt, arg1) \ - _gpgme_debug_frame_begin (), \ - _gpgme_debug (lvl, "%s: call: %s=%p, " fmt "\n", \ - name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1), \ - _gpgme_debug_frame_end () -#define TRACE2(lvl, name, tag, fmt, arg1, arg2) \ - _gpgme_debug_frame_begin (), \ - _gpgme_debug (lvl, "%s: call: %s=%p, " fmt "\n", \ - name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1, \ - arg2), _gpgme_debug_frame_end () -#define TRACE3(lvl, name, tag, fmt, arg1, arg2, arg3) \ - _gpgme_debug_frame_begin (), \ - _gpgme_debug (lvl, "%s: call: %s=%p, " fmt "\n", \ - name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1, \ - arg2, arg3), _gpgme_debug_frame_end () -#define TRACE6(lvl, name, tag, fmt, arg1, arg2, arg3, arg4, arg5, arg6) \ - _gpgme_debug_frame_begin (), \ - _gpgme_debug (lvl, "%s: call: %s=%p, " fmt "\n", \ - name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1, \ - arg2, arg3, arg4, arg5, arg6), \ - _gpgme_debug_frame_end () + _gpgme_debugf (lvl, 0, \ + name, STRINGIFY (tag), (void *) (uintptr_t) tag, \ + __VA_ARGS__), \ + _gpgme_debug_frame_end () #define TRACE_ERR(err) \ - err == 0 ? (TRACE_SUC ()) : \ + err == 0 ? (TRACE_SUC ("")) : \ (_gpgme_debug (_gpgme_trace_level, "%s:%d: error: %s <%s>\n", \ _gpgme_trace_func, __LINE__, gpgme_strerror (err), \ gpgme_strsource (err)), _gpgme_debug_frame_end (), (err)) + + /* The cast to void suppresses GCC warnings. */ #define TRACE_SYSRES(res) \ - res >= 0 ? ((void) (TRACE_SUC1 ("result=%i", res)), (res)) : \ - (_gpgme_debug (_gpgme_trace_level, "%s: error: %s\n", \ - _gpgme_trace_func, strerror (errno)), _gpgme_debug_frame_end (), (res)) + res >= 0 ? ((void) (TRACE_SUC ("result=%i", res)), (res)) : \ + (_gpgme_debug (_gpgme_trace_level, "%s: error: %s\n", \ + _gpgme_trace_func, strerror (errno)), \ + _gpgme_debug_frame_end (), (res)) #define TRACE_SYSERR(res) \ - res == 0 ? ((void) (TRACE_SUC1 ("result=%i", res)), (res)) : \ + res == 0 ? ((void) (TRACE_SUC ("result=%i", res)), (res)) : \ (_gpgme_debug (_gpgme_trace_level, "%s: error: %s\n", \ _gpgme_trace_func, strerror (res)), \ _gpgme_debug_frame_end (), (res)) #define TRACE_SYSERR_NR(res) \ - do { res == 0 ? ((void) (TRACE_SUC1 ("result=%i", res)), (res)) : \ + do { res == 0 ? ((void) (TRACE_SUC ("result=%i", res)), (res)) : \ (_gpgme_debug (_gpgme_trace_level, "%s: error: %s\n", \ _gpgme_trace_func, strerror (res)), \ _gpgme_debug_frame_end ()); } while (0) -#define TRACE_SUC() \ - _gpgme_debug (_gpgme_trace_level, "%s: leave\n", \ - _gpgme_trace_func), _gpgme_debug_frame_end () -#define TRACE_SUC0(fmt) \ - _gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \ - _gpgme_trace_func), _gpgme_debug_frame_end () -#define TRACE_SUC1(fmt, arg1) \ - _gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \ - _gpgme_trace_func, arg1), _gpgme_debug_frame_end () -#define TRACE_SUC2(fmt, arg1, arg2) \ - _gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \ - _gpgme_trace_func, arg1, arg2), _gpgme_debug_frame_end () -#define TRACE_SUC3(fmt, arg1, arg2, arg3) \ - _gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \ - _gpgme_trace_func, arg1, arg2, arg3), _gpgme_debug_frame_end () -#define TRACE_SUC4(fmt, arg1, arg2, arg3, arg4) \ - _gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \ - _gpgme_trace_func, arg1, arg2, arg3, arg4), \ - _gpgme_debug_frame_end () -#define TRACE_SUC5(fmt, arg1, arg2, arg3, arg4, arg5) \ - _gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \ - _gpgme_trace_func, arg1, arg2, arg3, arg4, arg5), \ - _gpgme_debug_frame_end () -#define TRACE_SUC6(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \ - _gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \ - _gpgme_trace_func, arg1, arg2, arg3, arg4, arg5, arg6), \ - _gpgme_debug_frame_end () +#define TRACE_SUC(...) \ + _gpgme_debugf (_gpgme_trace_level, 3, _gpgme_trace_func, NULL, NULL, \ + __VA_ARGS__), _gpgme_debug_frame_end () -#define TRACE_LOG(fmt) \ - _gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \ - _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag) -#define TRACE_LOG1(fmt, arg1) \ - _gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \ - _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \ - arg1) -#define TRACE_LOG2(fmt, arg1, arg2) \ - _gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \ - _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \ - arg1, arg2) -#define TRACE_LOG3(fmt, arg1, arg2, arg3) \ - _gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \ - _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \ - arg1, arg2, arg3) -#define TRACE_LOG4(fmt, arg1, arg2, arg3, arg4) \ - _gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \ - _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \ - arg1, arg2, arg3, arg4) -#define TRACE_LOG5(fmt, arg1, arg2, arg3, arg4, arg5) \ - _gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \ - _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \ - arg1, arg2, arg3, arg4, arg5) -#define TRACE_LOG6(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \ - _gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \ - _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \ - arg1, arg2, arg3, arg4, arg5, arg6) +#define TRACE_LOG(...) \ + _gpgme_debugf (_gpgme_trace_level, 2, \ + _gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \ + __VA_ARGS__) #define TRACE_LOGBUF(buf, len) \ _gpgme_debug_buffer (_gpgme_trace_level, "%s: check: %s", \ diff --git a/src/decrypt-verify.c b/src/decrypt-verify.c index b9c3103a..b63318f2 100644 --- a/src/decrypt-verify.c +++ b/src/decrypt-verify.c @@ -99,7 +99,7 @@ gpgme_op_decrypt_verify_start (gpgme_ctx_t ctx, gpgme_data_t cipher, { gpgme_error_t err; - TRACE_BEG2 (DEBUG_CTX, "gpgme_op_decrypt_verify_start", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_decrypt_verify_start", ctx, "cipher=%p, plain=%p", cipher, plain); if (!ctx) @@ -118,7 +118,7 @@ gpgme_op_decrypt_verify (gpgme_ctx_t ctx, gpgme_data_t cipher, { gpgme_error_t err; - TRACE_BEG2 (DEBUG_CTX, "gpgme_op_decrypt_verify", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_decrypt_verify", ctx, "cipher=%p, plain=%p", cipher, plain); if (!ctx) @@ -142,7 +142,7 @@ gpgme_op_decrypt_ext_start (gpgme_ctx_t ctx, { gpgme_error_t err; - TRACE_BEG2 (DEBUG_CTX, "gpgme_op_decrypt_ext_start", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_decrypt_ext_start", ctx, "cipher=%p, plain=%p", cipher, plain); if (!ctx) @@ -166,7 +166,7 @@ gpgme_op_decrypt_ext (gpgme_ctx_t ctx, { gpgme_error_t err; - TRACE_BEG2 (DEBUG_CTX, "gpgme_op_decrypt_ext", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_decrypt_ext", ctx, "cipher=%p, plain=%p", cipher, plain); if (!ctx) diff --git a/src/decrypt.c b/src/decrypt.c index 77c45627..f8847996 100644 --- a/src/decrypt.c +++ b/src/decrypt.c @@ -102,7 +102,7 @@ gpgme_op_decrypt_result (gpgme_ctx_t ctx) op_data_t opd; gpgme_error_t err; - TRACE_BEG (DEBUG_CTX, "gpgme_op_decrypt_result", ctx); + TRACE_BEG (DEBUG_CTX, "gpgme_op_decrypt_result", ctx, ""); ctx->ignore_mdc_error = 0; /* Always reset this flag. */ @@ -110,7 +110,7 @@ gpgme_op_decrypt_result (gpgme_ctx_t ctx) opd = hook; if (err || !opd) { - TRACE_SUC0 ("result=(null)"); + TRACE_SUC ("result=(null)"); return NULL; } @@ -120,7 +120,7 @@ gpgme_op_decrypt_result (gpgme_ctx_t ctx) opd->result.symkey_algo = strdup ("?.?"); if (!opd->result.symkey_algo) { - TRACE_SUC0 ("result=(null)"); + TRACE_SUC ("result=(null)"); return NULL; } } @@ -131,7 +131,7 @@ gpgme_op_decrypt_result (gpgme_ctx_t ctx) if (opd->result.unsupported_algorithm) { - TRACE_LOG1 ("result: unsupported_algorithm: %s", + TRACE_LOG ("result: unsupported_algorithm: %s", opd->result.unsupported_algorithm); } if (opd->result.wrong_key_usage) @@ -141,18 +141,18 @@ gpgme_op_decrypt_result (gpgme_ctx_t ctx) rcp = opd->result.recipients; while (rcp) { - TRACE_LOG3 ("result: recipient: keyid=%s, pubkey_algo=%i, " + TRACE_LOG ("result: recipient: keyid=%s, pubkey_algo=%i, " "status=%s", rcp->keyid, rcp->pubkey_algo, gpg_strerror (rcp->status)); rcp = rcp->next; } if (opd->result.file_name) { - TRACE_LOG1 ("result: original file name: %s", opd->result.file_name); + TRACE_LOG ("result: original file name: %s", opd->result.file_name); } } - TRACE_SUC1 ("result=%p", &opd->result); + TRACE_SUC ("result=%p", &opd->result); return &opd->result; } @@ -587,7 +587,7 @@ gpgme_op_decrypt_start (gpgme_ctx_t ctx, gpgme_data_t cipher, { gpgme_error_t err; - TRACE_BEG2 (DEBUG_CTX, "gpgme_op_decrypt_start", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_decrypt_start", ctx, "cipher=%p, plain=%p", cipher, plain); if (!ctx) @@ -605,7 +605,7 @@ gpgme_op_decrypt (gpgme_ctx_t ctx, gpgme_data_t cipher, gpgme_data_t plain) { gpgme_error_t err; - TRACE_BEG2 (DEBUG_CTX, "gpgme_op_decrypt", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_decrypt", ctx, "cipher=%p, plain=%p", cipher, plain); if (!ctx) diff --git a/src/delete.c b/src/delete.c index 1bf1cb48..cd7ab570 100644 --- a/src/delete.c +++ b/src/delete.c @@ -130,7 +130,7 @@ gpgme_op_delete_start (gpgme_ctx_t ctx, const gpgme_key_t key, { gpgme_error_t err; - TRACE_BEG3 (DEBUG_CTX, "gpgme_op_delete_start", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_delete_start", ctx, "key=%p (%s), allow_secret=%i", key, (key->subkeys && key->subkeys->fpr) ? key->subkeys->fpr : "invalid", allow_secret); @@ -151,7 +151,7 @@ gpgme_op_delete (gpgme_ctx_t ctx, const gpgme_key_t key, int allow_secret) { gpgme_error_t err; - TRACE_BEG3 (DEBUG_CTX, "gpgme_op_delete", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_delete", ctx, "key=%p (%s), allow_secret=%i", key, (key->subkeys && key->subkeys->fpr) ? key->subkeys->fpr : "invalid", allow_secret); @@ -174,7 +174,7 @@ gpgme_op_delete_ext_start (gpgme_ctx_t ctx, const gpgme_key_t key, { gpgme_error_t err; - TRACE_BEG3 (DEBUG_CTX, "gpgme_op_delete_ext_start", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_delete_ext_start", ctx, "key=%p (%s), flags=0x%x", key, (key->subkeys && key->subkeys->fpr) ? key->subkeys->fpr : "invalid", flags); @@ -194,7 +194,7 @@ gpgme_op_delete_ext (gpgme_ctx_t ctx, const gpgme_key_t key, { gpgme_error_t err; - TRACE_BEG3 (DEBUG_CTX, "gpgme_op_delete_ext", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_delete_ext", ctx, "key=%p (%s), flags=0x%x", key, (key->subkeys && key->subkeys->fpr) ? key->subkeys->fpr : "invalid", flags); diff --git a/src/edit.c b/src/edit.c index feb7cf66..a7d2bb51 100644 --- a/src/edit.c +++ b/src/edit.c @@ -158,7 +158,7 @@ gpgme_op_interact_start (gpgme_ctx_t ctx, gpgme_key_t key, unsigned int flags, { gpgme_error_t err; - TRACE_BEG5 (DEBUG_CTX, "gpgme_op_interact_start", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_interact_start", ctx, "key=%p flags=0x%x fnc=%p fnc_value=%p, out=%p", key, flags,fnc, fnc_value, out); @@ -177,7 +177,7 @@ gpgme_op_interact (gpgme_ctx_t ctx, gpgme_key_t key, unsigned int flags, { gpgme_error_t err; - TRACE_BEG5 (DEBUG_CTX, "gpgme_op_interact", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_interact", ctx, "key=%p flags=0x%x fnc=%p fnc_value=%p, out=%p", key, flags,fnc, fnc_value, out); @@ -234,7 +234,7 @@ gpgme_op_edit_start (gpgme_ctx_t ctx, gpgme_key_t key, { gpgme_error_t err; - TRACE_BEG5 (DEBUG_CTX, "gpgme_op_edit_start", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_edit_start", ctx, "key=%p (%s), fnc=%p fnc_value=%p, out=%p", key, (key && key->subkeys && key->subkeys->fpr) ? key->subkeys->fpr : "invalid", fnc, fnc_value, out); @@ -255,7 +255,7 @@ gpgme_op_edit (gpgme_ctx_t ctx, gpgme_key_t key, { gpgme_error_t err; - TRACE_BEG5 (DEBUG_CTX, "gpgme_op_edit", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_edit", ctx, "key=%p (%s), fnc=%p fnc_value=%p, out=%p", key, (key && key->subkeys && key->subkeys->fpr) ? key->subkeys->fpr : "invalid", fnc, fnc_value, out); @@ -278,7 +278,7 @@ gpgme_op_card_edit_start (gpgme_ctx_t ctx, gpgme_key_t key, { gpgme_error_t err; - TRACE_BEG5 (DEBUG_CTX, "gpgme_op_card_edit_start", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_card_edit_start", ctx, "key=%p (%s), fnc=%p fnc_value=%p, out=%p", key, (key && key->subkeys && key->subkeys->fpr) ? key->subkeys->fpr : "invalid", fnc, fnc_value, out); @@ -299,7 +299,7 @@ gpgme_op_card_edit (gpgme_ctx_t ctx, gpgme_key_t key, { gpgme_error_t err; - TRACE_BEG5 (DEBUG_CTX, "gpgme_op_card_edit", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_card_edit", ctx, "key=%p (%s), fnc=%p fnc_value=%p, out=%p", key, (key && key->subkeys && key->subkeys->fpr) ? key->subkeys->fpr : "invalid", fnc, fnc_value, out); diff --git a/src/encrypt-sign.c b/src/encrypt-sign.c index acc1a05d..e8272d8e 100644 --- a/src/encrypt-sign.c +++ b/src/encrypt-sign.c @@ -143,7 +143,7 @@ gpgme_op_encrypt_sign_ext (gpgme_ctx_t ctx, gpgme_key_t recp[], { gpgme_error_t err; - TRACE_BEG3 (DEBUG_CTX, "gpgme_op_encrypt_sign", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_encrypt_sign", ctx, "flags=0x%x, plain=%p, cipher=%p", flags, plain, cipher); if (!ctx) @@ -157,7 +157,7 @@ gpgme_op_encrypt_sign_ext (gpgme_ctx_t ctx, gpgme_key_t recp[], while (recp[i]) { - TRACE_LOG3 ("recipient[%i] = %p (%s)", i, recp[i], + TRACE_LOG ("recipient[%i] = %p (%s)", i, recp[i], (recp[i]->subkeys && recp[i]->subkeys->fpr) ? recp[i]->subkeys->fpr : "invalid"); i++; @@ -165,7 +165,7 @@ gpgme_op_encrypt_sign_ext (gpgme_ctx_t ctx, gpgme_key_t recp[], } else { - TRACE_LOG1 ("recipients = '%s'", recpstring); + TRACE_LOG ("recipients = '%s'", recpstring); } } @@ -187,7 +187,7 @@ gpgme_op_encrypt_sign_ext_start (gpgme_ctx_t ctx, gpgme_key_t recp[], { gpgme_error_t err; - TRACE_BEG3 (DEBUG_CTX, "gpgme_op_encrypt_sign_start", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_encrypt_sign_start", ctx, "flags=0x%x, plain=%p, cipher=%p", flags, plain, cipher); if (!ctx) @@ -201,7 +201,7 @@ gpgme_op_encrypt_sign_ext_start (gpgme_ctx_t ctx, gpgme_key_t recp[], while (recp[i]) { - TRACE_LOG3 ("recipient[%i] = %p (%s)", i, recp[i], + TRACE_LOG ("recipient[%i] = %p (%s)", i, recp[i], (recp[i]->subkeys && recp[i]->subkeys->fpr) ? recp[i]->subkeys->fpr : "invalid"); i++; @@ -209,7 +209,7 @@ gpgme_op_encrypt_sign_ext_start (gpgme_ctx_t ctx, gpgme_key_t recp[], } else { - TRACE_LOG1 ("recipients = '%s'", recpstring); + TRACE_LOG ("recipients = '%s'", recpstring); } } diff --git a/src/encrypt.c b/src/encrypt.c index b23d20d6..c5f668ea 100644 --- a/src/encrypt.c +++ b/src/encrypt.c @@ -78,14 +78,14 @@ gpgme_op_encrypt_result (gpgme_ctx_t ctx) op_data_t opd; gpgme_error_t err; - TRACE_BEG (DEBUG_CTX, "gpgme_op_encrypt_result", ctx); + TRACE_BEG (DEBUG_CTX, "gpgme_op_encrypt_result", ctx, ""); err = _gpgme_op_data_lookup (ctx, OPDATA_ENCRYPT, &hook, -1, NULL); opd = hook; if (err || !opd) { - TRACE_SUC0 ("result=(null)"); + TRACE_SUC ("result=(null)"); return NULL; } @@ -96,7 +96,7 @@ gpgme_op_encrypt_result (gpgme_ctx_t ctx) while (invkeys) { - TRACE_LOG3 ("invalid_recipients[%i] = %s (%s)", + TRACE_LOG ("invalid_recipients[%i] = %s (%s)", i, invkeys->fpr ? invkeys->fpr : "(null)", gpg_strerror (invkeys->reason)); invkeys = invkeys->next; @@ -104,7 +104,7 @@ gpgme_op_encrypt_result (gpgme_ctx_t ctx) } } - TRACE_SUC1 ("result=%p", &opd->result); + TRACE_SUC ("result=%p", &opd->result); return &opd->result; } @@ -291,7 +291,7 @@ gpgme_op_encrypt_ext (gpgme_ctx_t ctx, gpgme_key_t recp[], { gpgme_error_t err; - TRACE_BEG3 (DEBUG_CTX, "gpgme_op_encrypt", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_encrypt", ctx, "flags=0x%x, plain=%p, cipher=%p", flags, plain, cipher); if (!ctx) @@ -305,7 +305,7 @@ gpgme_op_encrypt_ext (gpgme_ctx_t ctx, gpgme_key_t recp[], while (recp[i]) { - TRACE_LOG3 ("recipient[%i] = %p (%s)", i, recp[i], + TRACE_LOG ("recipient[%i] = %p (%s)", i, recp[i], (recp[i]->subkeys && recp[i]->subkeys->fpr) ? recp[i]->subkeys->fpr : "invalid"); i++; @@ -313,7 +313,7 @@ gpgme_op_encrypt_ext (gpgme_ctx_t ctx, gpgme_key_t recp[], } else { - TRACE_LOG1 ("recipients = '%s'", recpstring); + TRACE_LOG ("recipients = '%s'", recpstring); } } @@ -332,7 +332,7 @@ gpgme_op_encrypt_ext_start (gpgme_ctx_t ctx, gpgme_key_t recp[], { gpgme_error_t err; - TRACE_BEG3 (DEBUG_CTX, "gpgme_op_encrypt_start", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_encrypt_start", ctx, "flags=0x%x, plain=%p, cipher=%p", flags, plain, cipher); if (!ctx) @@ -346,7 +346,7 @@ gpgme_op_encrypt_ext_start (gpgme_ctx_t ctx, gpgme_key_t recp[], while (recp[i]) { - TRACE_LOG3 ("recipient[%i] = %p (%s)", i, recp[i], + TRACE_LOG ("recipient[%i] = %p (%s)", i, recp[i], (recp[i]->subkeys && recp[i]->subkeys->fpr) ? recp[i]->subkeys->fpr : "invalid"); i++; @@ -354,7 +354,7 @@ gpgme_op_encrypt_ext_start (gpgme_ctx_t ctx, gpgme_key_t recp[], } else { - TRACE_LOG1 ("recipients = '%s'", recpstring); + TRACE_LOG ("recipients = '%s'", recpstring); } } diff --git a/src/engine-assuan.c b/src/engine-assuan.c index 83c0ca9f..79e826e0 100644 --- a/src/engine-assuan.c +++ b/src/engine-assuan.c @@ -493,13 +493,13 @@ llass_status_handler (void *opaque, int fd) case, we are done for now. */ if (gpg_err_code (err) == GPG_ERR_EAGAIN) { - TRACE1 (DEBUG_CTX, "gpgme:llass_status_handler", llass, + TRACE (DEBUG_CTX, "gpgme:llass_status_handler", llass, "fd 0x%x: EAGAIN reading assuan line (ignored)", fd); err = 0; continue; } - TRACE2 (DEBUG_CTX, "gpgme:llass_status_handler", llass, + TRACE (DEBUG_CTX, "gpgme:llass_status_handler", llass, "fd 0x%x: error reading assuan line: %s", fd, gpg_strerror (err)); } @@ -530,7 +530,7 @@ llass_status_handler (void *opaque, int fd) err = llass->user.data_cb (llass->user.data_cb_value, src, linelen); - TRACE2 (DEBUG_CTX, "gpgme:llass_status_handler", llass, + TRACE (DEBUG_CTX, "gpgme:llass_status_handler", llass, "fd 0x%x: D inlinedata; status from cb: %s", fd, (llass->user.data_cb ? (err? gpg_strerror (err):"ok"):"no callback")); @@ -543,7 +543,7 @@ llass_status_handler (void *opaque, int fd) if (llass->user.data_cb) err = llass->user.data_cb (llass->user.data_cb_value, NULL, 0); - TRACE2 (DEBUG_CTX, "gpgme:llass_status_handler", llass, + TRACE (DEBUG_CTX, "gpgme:llass_status_handler", llass, "fd 0x%x: END line; status from cb: %s", fd, (llass->user.data_cb ? (err? gpg_strerror (err):"ok"):"no callback")); @@ -569,7 +569,7 @@ llass_status_handler (void *opaque, int fd) err = llass->user.status_cb (llass->user.status_cb_value, src, args); - TRACE3 (DEBUG_CTX, "gpgme:llass_status_handler", llass, + TRACE (DEBUG_CTX, "gpgme:llass_status_handler", llass, "fd 0x%x: S line (%s) - status from cb: %s", fd, line+2, (llass->user.status_cb ? (err? gpg_strerror (err):"ok"):"no callback")); @@ -615,7 +615,7 @@ llass_status_handler (void *opaque, int fd) err = atoi (line+4); else err = gpg_error (GPG_ERR_GENERAL); - TRACE2 (DEBUG_CTX, "gpgme:llass_status_handler", llass, + TRACE (DEBUG_CTX, "gpgme:llass_status_handler", llass, "fd 0x%x: ERR line: %s", fd, err ? gpg_strerror (err) : "ok"); @@ -632,7 +632,7 @@ llass_status_handler (void *opaque, int fd) && line[0] == 'O' && line[1] == 'K' && (line[2] == '\0' || line[2] == ' ')) { - TRACE1 (DEBUG_CTX, "gpgme:llass_status_handler", llass, + TRACE (DEBUG_CTX, "gpgme:llass_status_handler", llass, "fd 0x%x: OK line", fd); llass->last_op_err = 0; @@ -657,7 +657,7 @@ add_io_cb (engine_llass_t llass, iocb_data_t *iocbd, gpgme_io_cb_t handler) { gpgme_error_t err; - TRACE_BEG2 (DEBUG_ENGINE, "engine-assuan:add_io_cb", llass, + TRACE_BEG (DEBUG_ENGINE, "engine-assuan:add_io_cb", llass, "fd %d, dir %d", iocbd->fd, iocbd->dir); err = (*llass->io_cbs.add) (llass->io_cbs.add_priv, iocbd->fd, iocbd->dir, @@ -784,7 +784,7 @@ llass_io_event (void *engine, gpgme_event_io_t type, void *type_data) { engine_llass_t llass = engine; - TRACE3 (DEBUG_ENGINE, "gpgme:llass_io_event", llass, + TRACE (DEBUG_ENGINE, "gpgme:llass_io_event", llass, "event %p, type %d, type_data %p", llass->io_cbs.event, type, type_data); if (llass->io_cbs.event) diff --git a/src/engine-g13.c b/src/engine-g13.c index 90f8e7ea..edb8d54f 100644 --- a/src/engine-g13.c +++ b/src/engine-g13.c @@ -486,7 +486,7 @@ status_handler (void *opaque, int fd) { /* Try our best to terminate the connection friendly. */ /* assuan_write_line (g13->assuan_ctx, "BYE"); */ - TRACE2 (DEBUG_CTX, "gpgme:status_handler", g13, + TRACE (DEBUG_CTX, "gpgme:status_handler", g13, "fd 0x%x: error reading assuan line: %s", fd, gpg_strerror (err)); } @@ -498,7 +498,7 @@ status_handler (void *opaque, int fd) err = atoi (&line[4]); if (! err) err = gpg_error (GPG_ERR_GENERAL); - TRACE2 (DEBUG_CTX, "gpgme:status_handler", g13, + TRACE (DEBUG_CTX, "gpgme:status_handler", g13, "fd 0x%x: ERR line: %s", fd, err ? gpg_strerror (err) : "ok"); @@ -514,7 +514,7 @@ status_handler (void *opaque, int fd) && line[0] == 'O' && line[1] == 'K' && (line[2] == '\0' || line[2] == ' ')) { - TRACE1 (DEBUG_CTX, "gpgme:status_handler", g13, + TRACE (DEBUG_CTX, "gpgme:status_handler", g13, "fd 0x%x: OK line", fd); _gpgme_io_close (g13->status_cb.fd); @@ -556,7 +556,7 @@ status_handler (void *opaque, int fd) else err = 0; - TRACE2 (DEBUG_CTX, "gpgme:g13_status_handler", g13, + TRACE (DEBUG_CTX, "gpgme:g13_status_handler", g13, "fd 0x%x: D inlinedata; status from cb: %s", fd, (g13->user.data_cb ? (err? gpg_strerror (err):"ok"):"no callback")); @@ -587,7 +587,7 @@ status_handler (void *opaque, int fd) else err = 0; - TRACE3 (DEBUG_CTX, "gpgme:g13_status_handler", g13, + TRACE (DEBUG_CTX, "gpgme:g13_status_handler", g13, "fd 0x%x: S line (%s) - status from cb: %s", fd, line+2, (g13->user.status_cb ? (err? gpg_strerror (err):"ok"):"no callback")); @@ -638,7 +638,7 @@ add_io_cb (engine_g13_t g13, iocb_data_t *iocbd, gpgme_io_cb_t handler) { gpgme_error_t err; - TRACE_BEG2 (DEBUG_ENGINE, "engine-g13:add_io_cb", g13, + TRACE_BEG (DEBUG_ENGINE, "engine-g13:add_io_cb", g13, "fd %d, dir %d", iocbd->fd, iocbd->dir); err = (*g13->io_cbs.add) (g13->io_cbs.add_priv, iocbd->fd, iocbd->dir, @@ -760,7 +760,7 @@ g13_io_event (void *engine, gpgme_event_io_t type, void *type_data) { engine_g13_t g13 = engine; - TRACE3 (DEBUG_ENGINE, "gpgme:g13_io_event", g13, + TRACE (DEBUG_ENGINE, "gpgme:g13_io_event", g13, "event %p, type %d, type_data %p", g13->io_cbs.event, type, type_data); if (g13->io_cbs.event) diff --git a/src/engine-gpg.c b/src/engine-gpg.c index c88e970a..31d219a3 100644 --- a/src/engine-gpg.c +++ b/src/engine-gpg.c @@ -165,7 +165,7 @@ gpg_io_event (void *engine, gpgme_event_io_t type, void *type_data) { engine_gpg_t gpg = engine; - TRACE3 (DEBUG_ENGINE, "gpgme:gpg_io_event", gpg, + TRACE (DEBUG_ENGINE, "gpgme:gpg_io_event", gpg, "event %p, type %d, type_data %p", gpg->io_cbs.event, type, type_data); if (gpg->io_cbs.event) @@ -1313,7 +1313,7 @@ read_status (engine_gpg_t gpg) received and the next thing will be that the command handler does its action. */ if (nread > 1) - TRACE0 (DEBUG_CTX, "gpgme:read_status", 0, + TRACE (DEBUG_CTX, "gpgme:read_status", 0, "error: unexpected data"); add_io_cb (gpg, gpg->cmd.fd, 0, @@ -1686,7 +1686,7 @@ gpg_decrypt (void *engine, if (have_gpg_version (gpg, "2.1.16")) { gpgme_data_release (gpg->override_session_key); - TRACE2 (DEBUG_ENGINE, "override", gpg, "seskey='%s' len=%zu\n", + TRACE (DEBUG_ENGINE, "override", gpg, "seskey='%s' len=%zu\n", override_session_key, strlen (override_session_key)); diff --git a/src/engine-gpgsm.c b/src/engine-gpgsm.c index a13af7fb..324c92a7 100644 --- a/src/engine-gpgsm.c +++ b/src/engine-gpgsm.c @@ -836,7 +836,7 @@ status_handler (void *opaque, int fd) { /* Try our best to terminate the connection friendly. */ /* assuan_write_line (gpgsm->assuan_ctx, "BYE"); */ - TRACE3 (DEBUG_CTX, "gpgme:status_handler", gpgsm, + TRACE (DEBUG_CTX, "gpgme:status_handler", gpgsm, "fd 0x%x: error from assuan (%d) getting status line : %s", fd, err, gpg_strerror (err)); } @@ -848,7 +848,7 @@ status_handler (void *opaque, int fd) err = atoi (&line[4]); if (! err) err = gpg_error (GPG_ERR_GENERAL); - TRACE2 (DEBUG_CTX, "gpgme:status_handler", gpgsm, + TRACE (DEBUG_CTX, "gpgme:status_handler", gpgsm, "fd 0x%x: ERR line - mapped to: %s", fd, err ? gpg_strerror (err) : "ok"); /* Try our best to terminate the connection friendly. */ @@ -877,7 +877,7 @@ status_handler (void *opaque, int fd) gpgsm->colon.any = 0; err = gpgsm->colon.fnc (gpgsm->colon.fnc_value, NULL); } - TRACE2 (DEBUG_CTX, "gpgme:status_handler", gpgsm, + TRACE (DEBUG_CTX, "gpgme:status_handler", gpgsm, "fd 0x%x: OK line - final status: %s", fd, err ? gpg_strerror (err) : "ok"); _gpgme_io_close (gpgsm->status_cb.fd); @@ -952,7 +952,7 @@ status_handler (void *opaque, int fd) dst++; } } - TRACE2 (DEBUG_CTX, "gpgme:status_handler", gpgsm, + TRACE (DEBUG_CTX, "gpgme:status_handler", gpgsm, "fd 0x%x: D line; final status: %s", fd, err? gpg_strerror (err):"ok"); } @@ -994,7 +994,7 @@ status_handler (void *opaque, int fd) linelen -= nwritten; } - TRACE2 (DEBUG_CTX, "gpgme:status_handler", gpgsm, + TRACE (DEBUG_CTX, "gpgme:status_handler", gpgsm, "fd 0x%x: D inlinedata; final status: %s", fd, err? gpg_strerror (err):"ok"); } @@ -1032,7 +1032,7 @@ status_handler (void *opaque, int fd) } else fprintf (stderr, "[UNKNOWN STATUS]%s %s", line + 2, rest); - TRACE3 (DEBUG_CTX, "gpgme:status_handler", gpgsm, + TRACE (DEBUG_CTX, "gpgme:status_handler", gpgsm, "fd 0x%x: S line (%s) - final status: %s", fd, line+2, err? gpg_strerror (err):"ok"); } @@ -1062,7 +1062,7 @@ add_io_cb (engine_gpgsm_t gpgsm, iocb_data_t *iocbd, gpgme_io_cb_t handler) { gpgme_error_t err; - TRACE_BEG2 (DEBUG_ENGINE, "engine-gpgsm:add_io_cb", gpgsm, + TRACE_BEG (DEBUG_ENGINE, "engine-gpgsm:add_io_cb", gpgsm, "fd %d, dir %d", iocbd->fd, iocbd->dir); err = (*gpgsm->io_cbs.add) (gpgsm->io_cbs.add_priv, iocbd->fd, iocbd->dir, @@ -2148,7 +2148,7 @@ gpgsm_io_event (void *engine, gpgme_event_io_t type, void *type_data) { engine_gpgsm_t gpgsm = engine; - TRACE3 (DEBUG_ENGINE, "gpgme:gpgsm_io_event", gpgsm, + TRACE (DEBUG_ENGINE, "gpgme:gpgsm_io_event", gpgsm, "event %p, type %d, type_data %p", gpgsm->io_cbs.event, type, type_data); if (gpgsm->io_cbs.event) diff --git a/src/engine-spawn.c b/src/engine-spawn.c index 6f57a7d3..296d7f25 100644 --- a/src/engine-spawn.c +++ b/src/engine-spawn.c @@ -381,7 +381,7 @@ engspawn_io_event (void *engine, gpgme_event_io_t type, void *type_data) { engine_spawn_t esp = engine; - TRACE3 (DEBUG_ENGINE, "gpgme:engspawn_io_event", esp, + TRACE (DEBUG_ENGINE, "gpgme:engspawn_io_event", esp, "event %p, type %d, type_data %p", esp->io_cbs.event, type, type_data); if (esp->io_cbs.event) diff --git a/src/engine-uiserver.c b/src/engine-uiserver.c index a79b3b13..62c4e5b6 100644 --- a/src/engine-uiserver.c +++ b/src/engine-uiserver.c @@ -659,7 +659,7 @@ status_handler (void *opaque, int fd) { /* Try our best to terminate the connection friendly. */ /* assuan_write_line (uiserver->assuan_ctx, "BYE"); */ - TRACE3 (DEBUG_CTX, "gpgme:status_handler", uiserver, + TRACE (DEBUG_CTX, "gpgme:status_handler", uiserver, "fd 0x%x: error from assuan (%d) getting status line : %s", fd, err, gpg_strerror (err)); } @@ -671,7 +671,7 @@ status_handler (void *opaque, int fd) err = atoi (&line[4]); if (! err) err = gpg_error (GPG_ERR_GENERAL); - TRACE2 (DEBUG_CTX, "gpgme:status_handler", uiserver, + TRACE (DEBUG_CTX, "gpgme:status_handler", uiserver, "fd 0x%x: ERR line - mapped to: %s", fd, err ? gpg_strerror (err) : "ok"); /* Try our best to terminate the connection friendly. */ @@ -700,7 +700,7 @@ status_handler (void *opaque, int fd) uiserver->colon.any = 0; err = uiserver->colon.fnc (uiserver->colon.fnc_value, NULL); } - TRACE2 (DEBUG_CTX, "gpgme:status_handler", uiserver, + TRACE (DEBUG_CTX, "gpgme:status_handler", uiserver, "fd 0x%x: OK line - final status: %s", fd, err ? gpg_strerror (err) : "ok"); _gpgme_io_close (uiserver->status_cb.fd); @@ -775,7 +775,7 @@ status_handler (void *opaque, int fd) dst++; } } - TRACE2 (DEBUG_CTX, "gpgme:status_handler", uiserver, + TRACE (DEBUG_CTX, "gpgme:status_handler", uiserver, "fd 0x%x: D line; final status: %s", fd, err? gpg_strerror (err):"ok"); } @@ -818,7 +818,7 @@ status_handler (void *opaque, int fd) linelen -= nwritten; } - TRACE2 (DEBUG_CTX, "gpgme:status_handler", uiserver, + TRACE (DEBUG_CTX, "gpgme:status_handler", uiserver, "fd 0x%x: D inlinedata; final status: %s", fd, err? gpg_strerror (err):"ok"); } @@ -848,7 +848,7 @@ status_handler (void *opaque, int fd) } else fprintf (stderr, "[UNKNOWN STATUS]%s %s", line + 2, rest); - TRACE3 (DEBUG_CTX, "gpgme:status_handler", uiserver, + TRACE (DEBUG_CTX, "gpgme:status_handler", uiserver, "fd 0x%x: S line (%s) - final status: %s", fd, line+2, err? gpg_strerror (err):"ok"); } @@ -878,7 +878,7 @@ add_io_cb (engine_uiserver_t uiserver, iocb_data_t *iocbd, gpgme_io_cb_t handler { gpgme_error_t err; - TRACE_BEG2 (DEBUG_ENGINE, "engine-uiserver:add_io_cb", uiserver, + TRACE_BEG (DEBUG_ENGINE, "engine-uiserver:add_io_cb", uiserver, "fd %d, dir %d", iocbd->fd, iocbd->dir); err = (*uiserver->io_cbs.add) (uiserver->io_cbs.add_priv, iocbd->fd, iocbd->dir, @@ -1395,7 +1395,7 @@ uiserver_io_event (void *engine, gpgme_event_io_t type, void *type_data) { engine_uiserver_t uiserver = engine; - TRACE3 (DEBUG_ENGINE, "gpgme:uiserver_io_event", uiserver, + TRACE (DEBUG_ENGINE, "gpgme:uiserver_io_event", uiserver, "event %p, type %d, type_data %p", uiserver->io_cbs.event, type, type_data); if (uiserver->io_cbs.event) diff --git a/src/export.c b/src/export.c index 0cc1099f..abf260ad 100644 --- a/src/export.c +++ b/src/export.c @@ -176,7 +176,7 @@ gpgme_op_export_start (gpgme_ctx_t ctx, const char *pattern, { gpgme_error_t err; - TRACE_BEG3 (DEBUG_CTX, "gpgme_op_export_start", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_export_start", ctx, "pattern=%s, mode=0x%x, keydata=%p", pattern, mode, keydata); if (!ctx) @@ -194,7 +194,7 @@ gpgme_op_export (gpgme_ctx_t ctx, const char *pattern, { gpgme_error_t err; - TRACE_BEG3 (DEBUG_CTX, "gpgme_op_export", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_export", ctx, "pattern=%s, mode=0x%x, keydata=%p", pattern, mode, keydata); if (!ctx) @@ -270,7 +270,7 @@ gpgme_op_export_ext_start (gpgme_ctx_t ctx, const char *pattern[], { gpgme_error_t err; - TRACE_BEG2 (DEBUG_CTX, "gpgme_op_export_ext_start", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_export_ext_start", ctx, "mode=0x%x, keydata=%p", mode, keydata); if (!ctx) @@ -282,7 +282,7 @@ gpgme_op_export_ext_start (gpgme_ctx_t ctx, const char *pattern[], while (pattern[i]) { - TRACE_LOG2 ("pattern[%i] = %s", i, pattern[i]); + TRACE_LOG ("pattern[%i] = %s", i, pattern[i]); i++; } } @@ -299,7 +299,7 @@ gpgme_op_export_ext (gpgme_ctx_t ctx, const char *pattern[], { gpgme_error_t err; - TRACE_BEG2 (DEBUG_CTX, "gpgme_op_export_ext_start", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_export_ext_start", ctx, "mode=0x%x, keydata=%p", mode, keydata); if (!ctx) @@ -311,7 +311,7 @@ gpgme_op_export_ext (gpgme_ctx_t ctx, const char *pattern[], while (pattern[i]) { - TRACE_LOG2 ("pattern[%i] = %s", i, pattern[i]); + TRACE_LOG ("pattern[%i] = %s", i, pattern[i]); i++; } } @@ -406,7 +406,7 @@ gpgme_op_export_keys_start (gpgme_ctx_t ctx, { gpg_error_t err; - TRACE_BEG2 (DEBUG_CTX, "gpgme_op_export_keys_start", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_export_keys_start", ctx, "mode=0x%x, keydata=%p", mode, keydata); if (!ctx) @@ -418,7 +418,7 @@ gpgme_op_export_keys_start (gpgme_ctx_t ctx, while (keys[i]) { - TRACE_LOG3 ("keys[%i] = %p (%s)", i, keys[i], + TRACE_LOG ("keys[%i] = %p (%s)", i, keys[i], (keys[i]->subkeys && keys[i]->subkeys->fpr) ? keys[i]->subkeys->fpr : "invalid"); i++; @@ -437,7 +437,7 @@ gpgme_op_export_keys (gpgme_ctx_t ctx, { gpgme_error_t err; - TRACE_BEG2 (DEBUG_CTX, "gpgme_op_export_keys", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_export_keys", ctx, "mode=0x%x, keydata=%p", mode, keydata); if (!ctx) @@ -449,7 +449,7 @@ gpgme_op_export_keys (gpgme_ctx_t ctx, while (keys[i]) { - TRACE_LOG3 ("keys[%i] = %p (%s)", i, keys[i], + TRACE_LOG ("keys[%i] = %p (%s)", i, keys[i], (keys[i]->subkeys && keys[i]->subkeys->fpr) ? keys[i]->subkeys->fpr : "invalid"); i++; diff --git a/src/genkey.c b/src/genkey.c index f76b7d88..b51dbf04 100644 --- a/src/genkey.c +++ b/src/genkey.c @@ -70,21 +70,21 @@ gpgme_op_genkey_result (gpgme_ctx_t ctx) op_data_t opd; gpgme_error_t err; - TRACE_BEG (DEBUG_CTX, "gpgme_op_genkey_result", ctx); + TRACE_BEG (DEBUG_CTX, "gpgme_op_genkey_result", ctx, ""); err = _gpgme_op_data_lookup (ctx, OPDATA_GENKEY, &hook, -1, NULL); opd = hook; if (err || !opd) { - TRACE_SUC0 ("result=(null)"); + TRACE_SUC ("result=(null)"); return NULL; } - TRACE_LOG3 ("fpr = %s, %s, %s", opd->result.fpr, + TRACE_LOG ("fpr = %s, %s, %s", opd->result.fpr, opd->result.primary ? "primary" : "no primary", opd->result.sub ? "sub" : "no sub"); - TRACE_SUC1 ("result=%p", &opd->result); + TRACE_SUC ("result=%p", &opd->result); return &opd->result; } @@ -286,7 +286,7 @@ gpgme_op_genkey_start (gpgme_ctx_t ctx, const char *parms, { gpgme_error_t err; - TRACE_BEG2 (DEBUG_CTX, "gpgme_op_genkey_start", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_genkey_start", ctx, "pubkey=%p, seckey=%p", pubkey, seckey); TRACE_LOGBUF (parms, parms? strlen (parms):0); @@ -307,7 +307,7 @@ gpgme_op_genkey (gpgme_ctx_t ctx, const char *parms, gpgme_data_t pubkey, { gpgme_error_t err; - TRACE_BEG2 (DEBUG_CTX, "gpgme_op_genkey", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_genkey", ctx, "pubkey=%p, seckey=%p", pubkey, seckey); TRACE_LOGBUF (parms, parms? strlen (parms):0); @@ -372,7 +372,7 @@ gpgme_op_createkey_start (gpgme_ctx_t ctx, const char *userid, const char *algo, { gpgme_error_t err; - TRACE_BEG3 (DEBUG_CTX, "gpgme_op_createkey_start", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_createkey_start", ctx, "userid='%s', algo='%s' flags=0x%x", userid, algo, flags); if (!ctx) @@ -391,7 +391,7 @@ gpgme_op_createkey (gpgme_ctx_t ctx, const char *userid, const char *algo, { gpgme_error_t err; - TRACE_BEG3 (DEBUG_CTX, "gpgme_op_createkey", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_createkey", ctx, "userid='%s', algo='%s' flags=0x%x", userid, algo, flags); if (!ctx) @@ -461,7 +461,7 @@ gpgme_op_createsubkey_start (gpgme_ctx_t ctx, gpgme_key_t key, const char *algo, { gpgme_error_t err; - TRACE_BEG3 (DEBUG_CTX, "gpgme_op_createsubkey_start", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_createsubkey_start", ctx, "key=%p, algo='%s' flags=0x%x", key, algo, flags); if (!ctx) @@ -479,7 +479,7 @@ gpgme_op_createsubkey (gpgme_ctx_t ctx, gpgme_key_t key, const char *algo, { gpgme_error_t err; - TRACE_BEG3 (DEBUG_CTX, "gpgme_op_createsubkey", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_createsubkey", ctx, "key=%p, algo='%s' flags=0x%x", key, algo, flags); if (!ctx) @@ -546,7 +546,7 @@ gpgme_op_adduid_start (gpgme_ctx_t ctx, { gpgme_error_t err; - TRACE_BEG2 (DEBUG_CTX, "gpgme_op_adduid_start", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_adduid_start", ctx, "uid='%s' flags=0x%x", userid, flags); if (!ctx) @@ -563,7 +563,7 @@ gpgme_op_adduid (gpgme_ctx_t ctx, { gpgme_error_t err; - TRACE_BEG2 (DEBUG_CTX, "gpgme_op_adduid", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_adduid", ctx, "uid='%s' flags=0x%x", userid, flags); if (!ctx) @@ -583,7 +583,7 @@ gpgme_op_revuid_start (gpgme_ctx_t ctx, { gpgme_error_t err; - TRACE_BEG2 (DEBUG_CTX, "gpgme_op_revuid_start", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_revuid_start", ctx, "uid='%s' flags=0x%x", userid, flags); if (!ctx) @@ -600,7 +600,7 @@ gpgme_op_revuid (gpgme_ctx_t ctx, { gpgme_error_t err; - TRACE_BEG2 (DEBUG_CTX, "gpgme_op_revuid", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_revuid", ctx, "uid='%s' flags=0x%x", userid, flags); if (!ctx) @@ -622,7 +622,7 @@ set_uid_flag (gpgme_ctx_t ctx, int synchronous, { gpgme_error_t err; - TRACE_BEG4 (DEBUG_CTX, "gpgme_op_set_uid_flag", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_set_uid_flag", ctx, "%d uid='%s' '%s'='%s'", synchronous, userid, name, value); if (!ctx || !name || !key || !userid) diff --git a/src/getauditlog.c b/src/getauditlog.c index 2d3f7f99..13473873 100644 --- a/src/getauditlog.c +++ b/src/getauditlog.c @@ -71,7 +71,7 @@ gpgme_op_getauditlog_start (gpgme_ctx_t ctx, gpgme_data_t output, unsigned int flags) { gpg_error_t err; - TRACE_BEG2 (DEBUG_CTX, "gpgme_op_getauditlog_start", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_getauditlog_start", ctx, "output=%p, flags=0x%x", output, flags); if (!ctx) @@ -91,7 +91,7 @@ gpgme_op_getauditlog (gpgme_ctx_t ctx, gpgme_data_t output, unsigned int flags) { gpgme_error_t err; - TRACE_BEG2 (DEBUG_CTX, "gpgme_op_getauditlog", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_getauditlog", ctx, "output=%p, flags=0x%x", output, flags); if (!ctx) diff --git a/src/gpgme.c b/src/gpgme.c index 4dbec0c7..ac98bd59 100644 --- a/src/gpgme.c +++ b/src/gpgme.c @@ -94,7 +94,7 @@ gpgme_new (gpgme_ctx_t *r_ctx) { gpgme_error_t err; gpgme_ctx_t ctx; - TRACE_BEG (DEBUG_CTX, "gpgme_new", r_ctx); + TRACE_BEG (DEBUG_CTX, "gpgme_new", r_ctx, ""); if (_gpgme_selftest) return TRACE_ERR (_gpgme_selftest); @@ -159,7 +159,7 @@ gpgme_new (gpgme_ctx_t *r_ctx) *r_ctx = ctx; - return TRACE_SUC1 ("ctx=%p", ctx); + return TRACE_SUC ("ctx=%p", ctx); } @@ -170,7 +170,7 @@ _gpgme_cancel_with_err (gpgme_ctx_t ctx, gpg_error_t ctx_err, gpgme_error_t err; struct gpgme_io_event_done_data data; - TRACE_BEG2 (DEBUG_CTX, "_gpgme_cancel_with_err", ctx, "ctx_err=%i, op_err=%i", + TRACE_BEG (DEBUG_CTX, "_gpgme_cancel_with_err", ctx, "ctx_err=%i, op_err=%i", ctx_err, op_err); if (ctx_err) @@ -201,7 +201,7 @@ gpgme_cancel (gpgme_ctx_t ctx) { gpg_error_t err; - TRACE_BEG (DEBUG_CTX, "gpgme_cancel", ctx); + TRACE_BEG (DEBUG_CTX, "gpgme_cancel", ctx, ""); if (!ctx) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); @@ -216,7 +216,7 @@ gpgme_cancel (gpgme_ctx_t ctx) gpgme_error_t gpgme_cancel_async (gpgme_ctx_t ctx) { - TRACE_BEG (DEBUG_CTX, "gpgme_cancel_async", ctx); + TRACE_BEG (DEBUG_CTX, "gpgme_cancel_async", ctx, ""); if (!ctx) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); @@ -233,7 +233,7 @@ gpgme_cancel_async (gpgme_ctx_t ctx) void gpgme_release (gpgme_ctx_t ctx) { - TRACE (DEBUG_CTX, "gpgme_release", ctx); + TRACE (DEBUG_CTX, "gpgme_release", ctx, ""); if (!ctx) return; @@ -322,7 +322,7 @@ _gpgme_release_result (gpgme_ctx_t ctx) gpgme_error_t gpgme_set_protocol (gpgme_ctx_t ctx, gpgme_protocol_t protocol) { - TRACE_BEG2 (DEBUG_CTX, "gpgme_set_protocol", ctx, "protocol=%i (%s)", + TRACE_BEG (DEBUG_CTX, "gpgme_set_protocol", ctx, "protocol=%i (%s)", protocol, gpgme_get_protocol_name (protocol) ? gpgme_get_protocol_name (protocol) : "invalid"); @@ -343,7 +343,7 @@ gpgme_set_protocol (gpgme_ctx_t ctx, gpgme_protocol_t protocol) /* Shut down the engine when switching protocols. */ if (ctx->engine) { - TRACE_LOG1 ("releasing ctx->engine=%p", ctx->engine); + TRACE_LOG ("releasing ctx->engine=%p", ctx->engine); _gpgme_engine_release (ctx->engine); ctx->engine = NULL; } @@ -357,7 +357,7 @@ gpgme_set_protocol (gpgme_ctx_t ctx, gpgme_protocol_t protocol) gpgme_protocol_t gpgme_get_protocol (gpgme_ctx_t ctx) { - TRACE2 (DEBUG_CTX, "gpgme_get_protocol", ctx, + TRACE (DEBUG_CTX, "gpgme_get_protocol", ctx, "ctx->protocol=%i (%s)", ctx->protocol, gpgme_get_protocol_name (ctx->protocol) ? gpgme_get_protocol_name (ctx->protocol) : "invalid"); @@ -369,7 +369,7 @@ gpgme_get_protocol (gpgme_ctx_t ctx) gpgme_error_t gpgme_set_sub_protocol (gpgme_ctx_t ctx, gpgme_protocol_t protocol) { - TRACE2 (DEBUG_CTX, "gpgme_set_sub_protocol", ctx, "protocol=%i (%s)", + TRACE (DEBUG_CTX, "gpgme_set_sub_protocol", ctx, "protocol=%i (%s)", protocol, gpgme_get_protocol_name (protocol) ? gpgme_get_protocol_name (protocol) : "invalid"); @@ -384,7 +384,7 @@ gpgme_set_sub_protocol (gpgme_ctx_t ctx, gpgme_protocol_t protocol) gpgme_protocol_t gpgme_get_sub_protocol (gpgme_ctx_t ctx) { - TRACE2 (DEBUG_CTX, "gpgme_get_sub_protocol", ctx, + TRACE (DEBUG_CTX, "gpgme_get_sub_protocol", ctx, "ctx->sub_protocol=%i (%s)", ctx->sub_protocol, gpgme_get_protocol_name (ctx->sub_protocol) ? gpgme_get_protocol_name (ctx->sub_protocol) : "invalid"); @@ -441,7 +441,7 @@ gpgme_set_sender (gpgme_ctx_t ctx, const char *address) { char *p = NULL; - TRACE_BEG1 (DEBUG_CTX, "gpgme_set_sender", ctx, "sender='%s'", + TRACE_BEG (DEBUG_CTX, "gpgme_set_sender", ctx, "sender='%s'", address?address:"(null)"); if (!ctx || (address && !(p = _gpgme_mailbox_from_userid (address)))) @@ -459,7 +459,7 @@ gpgme_set_sender (gpgme_ctx_t ctx, const char *address) const char * gpgme_get_sender (gpgme_ctx_t ctx) { - TRACE1 (DEBUG_CTX, "gpgme_get_sender", ctx, "sender='%s'", + TRACE (DEBUG_CTX, "gpgme_get_sender", ctx, "sender='%s'", ctx?ctx->sender:""); return ctx->sender; @@ -470,7 +470,7 @@ gpgme_get_sender (gpgme_ctx_t ctx) void gpgme_set_armor (gpgme_ctx_t ctx, int use_armor) { - TRACE2 (DEBUG_CTX, "gpgme_set_armor", ctx, "use_armor=%i (%s)", + TRACE (DEBUG_CTX, "gpgme_set_armor", ctx, "use_armor=%i (%s)", use_armor, use_armor ? "yes" : "no"); if (!ctx) @@ -484,7 +484,7 @@ gpgme_set_armor (gpgme_ctx_t ctx, int use_armor) int gpgme_get_armor (gpgme_ctx_t ctx) { - TRACE2 (DEBUG_CTX, "gpgme_get_armor", ctx, "ctx->use_armor=%i (%s)", + TRACE (DEBUG_CTX, "gpgme_get_armor", ctx, "ctx->use_armor=%i (%s)", ctx->use_armor, ctx->use_armor ? "yes" : "no"); return ctx->use_armor; } @@ -499,7 +499,7 @@ gpgme_set_ctx_flag (gpgme_ctx_t ctx, const char *name, const char *value) gpgme_error_t err = 0; int abool; - TRACE2 (DEBUG_CTX, "gpgme_set_ctx_flag", ctx, + TRACE (DEBUG_CTX, "gpgme_set_ctx_flag", ctx, "name='%s' value='%s'", name? name:"(null)", value?value:"(null)"); @@ -632,7 +632,7 @@ gpgme_get_ctx_flag (gpgme_ctx_t ctx, const char *name) void gpgme_set_textmode (gpgme_ctx_t ctx, int use_textmode) { - TRACE2 (DEBUG_CTX, "gpgme_set_textmode", ctx, "use_textmode=%i (%s)", + TRACE (DEBUG_CTX, "gpgme_set_textmode", ctx, "use_textmode=%i (%s)", use_textmode, use_textmode ? "yes" : "no"); if (!ctx) @@ -645,7 +645,7 @@ gpgme_set_textmode (gpgme_ctx_t ctx, int use_textmode) int gpgme_get_textmode (gpgme_ctx_t ctx) { - TRACE2 (DEBUG_CTX, "gpgme_get_textmode", ctx, "ctx->use_textmode=%i (%s)", + TRACE (DEBUG_CTX, "gpgme_get_textmode", ctx, "ctx->use_textmode=%i (%s)", ctx->use_textmode, ctx->use_textmode ? "yes" : "no"); return ctx->use_textmode; } @@ -656,7 +656,7 @@ gpgme_get_textmode (gpgme_ctx_t ctx) void gpgme_set_offline (gpgme_ctx_t ctx, int offline) { - TRACE2 (DEBUG_CTX, "gpgme_set_offline", ctx, "offline=%i (%s)", + TRACE (DEBUG_CTX, "gpgme_set_offline", ctx, "offline=%i (%s)", offline, offline ? "yes" : "no"); if (!ctx) @@ -669,7 +669,7 @@ gpgme_set_offline (gpgme_ctx_t ctx, int offline) int gpgme_get_offline (gpgme_ctx_t ctx) { - TRACE2 (DEBUG_CTX, "gpgme_get_offline", ctx, "ctx->offline=%i (%s)", + TRACE (DEBUG_CTX, "gpgme_get_offline", ctx, "ctx->offline=%i (%s)", ctx->offline, ctx->offline ? "yes" : "no"); return ctx->offline; } @@ -691,7 +691,7 @@ gpgme_set_include_certs (gpgme_ctx_t ctx, int nr_of_certs) else ctx->include_certs = nr_of_certs; - TRACE2 (DEBUG_CTX, "gpgme_set_include_certs", ctx, "nr_of_certs=%i%s", + TRACE (DEBUG_CTX, "gpgme_set_include_certs", ctx, "nr_of_certs=%i%s", nr_of_certs, nr_of_certs == ctx->include_certs ? "" : " (-2)"); } @@ -701,7 +701,7 @@ gpgme_set_include_certs (gpgme_ctx_t ctx, int nr_of_certs) int gpgme_get_include_certs (gpgme_ctx_t ctx) { - TRACE1 (DEBUG_CTX, "gpgme_get_include_certs", ctx, "ctx->include_certs=%i", + TRACE (DEBUG_CTX, "gpgme_get_include_certs", ctx, "ctx->include_certs=%i", ctx->include_certs); return ctx->include_certs; } @@ -713,7 +713,7 @@ gpgme_get_include_certs (gpgme_ctx_t ctx) gpgme_error_t gpgme_set_keylist_mode (gpgme_ctx_t ctx, gpgme_keylist_mode_t mode) { - TRACE1 (DEBUG_CTX, "gpgme_set_keylist_mode", ctx, "keylist_mode=0x%x", + TRACE (DEBUG_CTX, "gpgme_set_keylist_mode", ctx, "keylist_mode=0x%x", mode); if (!ctx) @@ -728,7 +728,7 @@ gpgme_set_keylist_mode (gpgme_ctx_t ctx, gpgme_keylist_mode_t mode) gpgme_keylist_mode_t gpgme_get_keylist_mode (gpgme_ctx_t ctx) { - TRACE1 (DEBUG_CTX, "gpgme_get_keylist_mode", ctx, + TRACE (DEBUG_CTX, "gpgme_get_keylist_mode", ctx, "ctx->keylist_mode=0x%x", ctx->keylist_mode); return ctx->keylist_mode; } @@ -738,7 +738,7 @@ gpgme_get_keylist_mode (gpgme_ctx_t ctx) gpgme_error_t gpgme_set_pinentry_mode (gpgme_ctx_t ctx, gpgme_pinentry_mode_t mode) { - TRACE1 (DEBUG_CTX, "gpgme_set_pinentry_mode", ctx, "pinentry_mode=%u", + TRACE (DEBUG_CTX, "gpgme_set_pinentry_mode", ctx, "pinentry_mode=%u", (unsigned int)mode); if (!ctx) @@ -765,7 +765,7 @@ gpgme_set_pinentry_mode (gpgme_ctx_t ctx, gpgme_pinentry_mode_t mode) gpgme_pinentry_mode_t gpgme_get_pinentry_mode (gpgme_ctx_t ctx) { - TRACE1 (DEBUG_CTX, "gpgme_get_pinentry_mode", ctx, + TRACE (DEBUG_CTX, "gpgme_get_pinentry_mode", ctx, "ctx->pinentry_mode=%u", (unsigned int)ctx->pinentry_mode); return ctx->pinentry_mode; } @@ -777,7 +777,7 @@ void gpgme_set_passphrase_cb (gpgme_ctx_t ctx, gpgme_passphrase_cb_t cb, void *cb_value) { - TRACE2 (DEBUG_CTX, "gpgme_set_passphrase_cb", ctx, + TRACE (DEBUG_CTX, "gpgme_set_passphrase_cb", ctx, "passphrase_cb=%p/%p", cb, cb_value); if (!ctx) @@ -794,7 +794,7 @@ void gpgme_get_passphrase_cb (gpgme_ctx_t ctx, gpgme_passphrase_cb_t *r_cb, void **r_cb_value) { - TRACE2 (DEBUG_CTX, "gpgme_get_passphrase_cb", ctx, + TRACE (DEBUG_CTX, "gpgme_get_passphrase_cb", ctx, "ctx->passphrase_cb=%p/%p", ctx->passphrase_cb, ctx->passphrase_cb_value); if (r_cb) @@ -809,7 +809,7 @@ gpgme_get_passphrase_cb (gpgme_ctx_t ctx, gpgme_passphrase_cb_t *r_cb, void gpgme_set_progress_cb (gpgme_ctx_t ctx, gpgme_progress_cb_t cb, void *cb_value) { - TRACE2 (DEBUG_CTX, "gpgme_set_progress_cb", ctx, "progress_cb=%p/%p", + TRACE (DEBUG_CTX, "gpgme_set_progress_cb", ctx, "progress_cb=%p/%p", cb, cb_value); if (!ctx) @@ -826,7 +826,7 @@ void gpgme_get_progress_cb (gpgme_ctx_t ctx, gpgme_progress_cb_t *r_cb, void **r_cb_value) { - TRACE2 (DEBUG_CTX, "gpgme_get_progress_cb", ctx, "ctx->progress_cb=%p/%p", + TRACE (DEBUG_CTX, "gpgme_get_progress_cb", ctx, "ctx->progress_cb=%p/%p", ctx->progress_cb, ctx->progress_cb_value); if (r_cb) *r_cb = ctx->progress_cb; @@ -840,7 +840,7 @@ gpgme_get_progress_cb (gpgme_ctx_t ctx, gpgme_progress_cb_t *r_cb, void gpgme_set_status_cb (gpgme_ctx_t ctx, gpgme_status_cb_t cb, void *cb_value) { - TRACE2 (DEBUG_CTX, "gpgme_set_status_cb", ctx, "status_cb=%p/%p", + TRACE (DEBUG_CTX, "gpgme_set_status_cb", ctx, "status_cb=%p/%p", cb, cb_value); if (!ctx) @@ -857,7 +857,7 @@ void gpgme_get_status_cb (gpgme_ctx_t ctx, gpgme_status_cb_t *r_cb, void **r_cb_value) { - TRACE2 (DEBUG_CTX, "gpgme_get_status_cb", ctx, "ctx->status_cb=%p/%p", + TRACE (DEBUG_CTX, "gpgme_get_status_cb", ctx, "ctx->status_cb=%p/%p", ctx ? ctx->status_cb : NULL, ctx ? ctx->status_cb_value : NULL); if (r_cb) @@ -885,7 +885,7 @@ gpgme_set_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs) if (io_cbs) { - TRACE6 (DEBUG_CTX, "gpgme_set_io_cbs", ctx, + TRACE (DEBUG_CTX, "gpgme_set_io_cbs", ctx, "io_cbs=%p (add=%p/%p, remove=%p, event=%p/%p", io_cbs, io_cbs->add, io_cbs->add_priv, io_cbs->remove, io_cbs->event, io_cbs->event_priv); @@ -893,7 +893,7 @@ gpgme_set_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs) } else { - TRACE1 (DEBUG_CTX, "gpgme_set_io_cbs", ctx, + TRACE (DEBUG_CTX, "gpgme_set_io_cbs", ctx, "io_cbs=%p (default)", io_cbs); ctx->io_cbs.add = NULL; ctx->io_cbs.add_priv = NULL; @@ -910,7 +910,7 @@ gpgme_ssize_t gpgme_io_read (int fd, void *buffer, size_t count) { int ret; - TRACE_BEG2 (DEBUG_GLOBAL, "gpgme_io_read", fd, + TRACE_BEG (DEBUG_GLOBAL, "gpgme_io_read", fd, "buffer=%p, count=%u", buffer, count); ret = _gpgme_io_read (fd, buffer, count); @@ -926,7 +926,7 @@ gpgme_ssize_t gpgme_io_write (int fd, const void *buffer, size_t count) { int ret; - TRACE_BEG2 (DEBUG_GLOBAL, "gpgme_io_write", fd, + TRACE_BEG (DEBUG_GLOBAL, "gpgme_io_write", fd, "buffer=%p, count=%u", buffer, count); ret = _gpgme_io_write (fd, buffer, count); @@ -945,7 +945,7 @@ gpgme_io_writen (int fd, const void *buffer_arg, size_t count) { const char *buffer = buffer_arg; int ret = 0; - TRACE_BEG2 (DEBUG_GLOBAL, "gpgme_io_writen", fd, + TRACE_BEG (DEBUG_GLOBAL, "gpgme_io_writen", fd, "buffer=%p, count=%u", buffer, count); while (count) { @@ -964,7 +964,7 @@ gpgme_io_writen (int fd, const void *buffer_arg, size_t count) void gpgme_get_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs) { - TRACE6 (DEBUG_CTX, "gpgme_get_io_cbs", ctx, + TRACE (DEBUG_CTX, "gpgme_get_io_cbs", ctx, "io_cbs=%p, ctx->io_cbs.add=%p/%p, .remove=%p, .event=%p/%p", io_cbs, io_cbs->add, io_cbs->add_priv, io_cbs->remove, io_cbs->event, io_cbs->event_priv); @@ -982,7 +982,7 @@ gpgme_set_locale (gpgme_ctx_t ctx, int category, const char *value) char *new_lc_ctype = NULL; char *new_lc_messages = NULL; - TRACE_BEG2 (DEBUG_CTX, "gpgme_set_locale", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_set_locale", ctx, "category=%i, value=%s", category, value ? value : "(null)"); #define PREPARE_ONE_LOCALE(lcat, ucat) \ @@ -1051,7 +1051,7 @@ gpgme_set_locale (gpgme_ctx_t ctx, int category, const char *value) gpgme_engine_info_t gpgme_ctx_get_engine_info (gpgme_ctx_t ctx) { - TRACE1 (DEBUG_CTX, "gpgme_ctx_get_engine_info", ctx, + TRACE (DEBUG_CTX, "gpgme_ctx_get_engine_info", ctx, "ctx->engine_info=%p", ctx->engine_info); return ctx->engine_info; } @@ -1064,7 +1064,7 @@ gpgme_ctx_set_engine_info (gpgme_ctx_t ctx, gpgme_protocol_t proto, const char *file_name, const char *home_dir) { gpgme_error_t err; - TRACE_BEG4 (DEBUG_CTX, "gpgme_ctx_set_engine_info", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_ctx_set_engine_info", ctx, "protocol=%i (%s), file_name=%s, home_dir=%s", proto, gpgme_get_protocol_name (proto) ? gpgme_get_protocol_name (proto) : "unknown", @@ -1077,7 +1077,7 @@ gpgme_ctx_set_engine_info (gpgme_ctx_t ctx, gpgme_protocol_t proto, /* Shut down the engine when changing engine info. */ if (ctx->engine) { - TRACE_LOG1 ("releasing ctx->engine=%p", ctx->engine); + TRACE_LOG ("releasing ctx->engine=%p", ctx->engine); _gpgme_engine_release (ctx->engine); ctx->engine = NULL; } @@ -1109,7 +1109,7 @@ _gpgme_sig_notation_clear (gpgme_ctx_t ctx) void gpgme_sig_notation_clear (gpgme_ctx_t ctx) { - TRACE (DEBUG_CTX, "gpgme_sig_notation_clear", ctx); + TRACE (DEBUG_CTX, "gpgme_sig_notation_clear", ctx, ""); if (!ctx) return; @@ -1131,7 +1131,7 @@ gpgme_sig_notation_add (gpgme_ctx_t ctx, const char *name, gpgme_sig_notation_t notation; gpgme_sig_notation_t *lastp; - TRACE_BEG3 (DEBUG_CTX, "gpgme_sig_notation_add", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_sig_notation_add", ctx, "name=%s, value=%s, flags=0x%x", name ? name : "(null)", value ? value : "(null)", flags); @@ -1164,10 +1164,10 @@ gpgme_sig_notation_get (gpgme_ctx_t ctx) { if (!ctx) { - TRACE (DEBUG_CTX, "gpgme_sig_notation_get", ctx); + TRACE (DEBUG_CTX, "gpgme_sig_notation_get", ctx, ""); return NULL; } - TRACE1 (DEBUG_CTX, "gpgme_sig_notation_get", ctx, + TRACE (DEBUG_CTX, "gpgme_sig_notation_get", ctx, "ctx->sig_notations=%p", ctx->sig_notations); return ctx->sig_notations; diff --git a/src/import.c b/src/import.c index 33779e96..3d49146f 100644 --- a/src/import.c +++ b/src/import.c @@ -67,13 +67,13 @@ gpgme_op_import_result (gpgme_ctx_t ctx) op_data_t opd; gpgme_error_t err; - TRACE_BEG (DEBUG_CTX, "gpgme_op_import_result", ctx); + TRACE_BEG (DEBUG_CTX, "gpgme_op_import_result", ctx, ""); err = _gpgme_op_data_lookup (ctx, OPDATA_IMPORT, &hook, -1, NULL); opd = hook; if (err || !opd) { - TRACE_SUC0 ("result=(null)"); + TRACE_SUC ("result=(null)"); return NULL; } @@ -83,18 +83,18 @@ gpgme_op_import_result (gpgme_ctx_t ctx) gpgme_import_status_t impstat; int i; - TRACE_LOG5 ("%i considered, %i no UID, %i imported, %i imported RSA, " + TRACE_LOG ("%i considered, %i no UID, %i imported, %i imported RSA, " "%i unchanged", opd->result.considered, opd->result.no_user_id, opd->result.imported, opd->result.imported_rsa, opd->result.unchanged); - TRACE_LOG4 ("%i new UIDs, %i new sub keys, %i new signatures, " + TRACE_LOG ("%i new UIDs, %i new sub keys, %i new signatures, " "%i new revocations", opd->result.new_user_ids, opd->result.new_sub_keys, opd->result.new_signatures, opd->result.new_revocations); - TRACE_LOG3 ("%i secret keys, %i imported, %i unchanged", + TRACE_LOG ("%i secret keys, %i imported, %i unchanged", opd->result.secret_read, opd->result.secret_imported, opd->result.secret_unchanged); - TRACE_LOG3 ("%i skipped new keys, %i not imported, %i v3 skipped", + TRACE_LOG ("%i skipped new keys, %i not imported, %i v3 skipped", opd->result.skipped_new_keys, opd->result.not_imported, opd->result.skipped_v3_keys); @@ -102,14 +102,14 @@ gpgme_op_import_result (gpgme_ctx_t ctx) i = 0; while (impstat) { - TRACE_LOG4 ("import[%i] for %s = 0x%x (%s)", + TRACE_LOG ("import[%i] for %s = 0x%x (%s)", i, impstat->fpr, impstat->status, impstat->result); impstat = impstat->next; i++; } } - TRACE_SUC1 ("result=%p", &opd->result); + TRACE_SUC ("result=%p", &opd->result); return &opd->result; } @@ -290,7 +290,7 @@ gpgme_op_import_start (gpgme_ctx_t ctx, gpgme_data_t keydata) { gpg_error_t err; - TRACE_BEG1 (DEBUG_CTX, "gpgme_op_import_start", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_import_start", ctx, "keydata=%p", keydata); if (!ctx) @@ -307,7 +307,7 @@ gpgme_op_import (gpgme_ctx_t ctx, gpgme_data_t keydata) { gpgme_error_t err; - TRACE_BEG1 (DEBUG_CTX, "gpgme_op_import", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_import", ctx, "keydata=%p", keydata); if (!ctx) @@ -374,7 +374,7 @@ gpgme_op_import_keys_start (gpgme_ctx_t ctx, gpgme_key_t *keys) { gpg_error_t err; - TRACE_BEG (DEBUG_CTX, "gpgme_op_import_keys_start", ctx); + TRACE_BEG (DEBUG_CTX, "gpgme_op_import_keys_start", ctx, ""); if (!ctx) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); @@ -385,7 +385,7 @@ gpgme_op_import_keys_start (gpgme_ctx_t ctx, gpgme_key_t *keys) while (keys[i]) { - TRACE_LOG3 ("keys[%i] = %p (%s)", i, keys[i], + TRACE_LOG ("keys[%i] = %p (%s)", i, keys[i], (keys[i]->subkeys && keys[i]->subkeys->fpr) ? keys[i]->subkeys->fpr : "invalid"); i++; @@ -412,7 +412,7 @@ gpgme_op_import_keys (gpgme_ctx_t ctx, gpgme_key_t *keys) { gpgme_error_t err; - TRACE_BEG (DEBUG_CTX, "gpgme_op_import_keys", ctx); + TRACE_BEG (DEBUG_CTX, "gpgme_op_import_keys", ctx, ""); if (!ctx) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); @@ -423,7 +423,7 @@ gpgme_op_import_keys (gpgme_ctx_t ctx, gpgme_key_t *keys) while (keys[i]) { - TRACE_LOG3 ("keys[%i] = %p (%s)", i, keys[i], + TRACE_LOG ("keys[%i] = %p (%s)", i, keys[i], (keys[i]->subkeys && keys[i]->subkeys->fpr) ? keys[i]->subkeys->fpr : "invalid"); i++; diff --git a/src/keylist.c b/src/keylist.c index a0fa841b..7ea7b267 100644 --- a/src/keylist.c +++ b/src/keylist.c @@ -101,19 +101,19 @@ gpgme_op_keylist_result (gpgme_ctx_t ctx) op_data_t opd; gpgme_error_t err; - TRACE_BEG (DEBUG_CTX, "gpgme_op_keylist_result", ctx); + TRACE_BEG (DEBUG_CTX, "gpgme_op_keylist_result", ctx, ""); err = _gpgme_op_data_lookup (ctx, OPDATA_KEYLIST, &hook, -1, NULL); opd = hook; if (err || !opd) { - TRACE_SUC0 ("result=(null)"); + TRACE_SUC ("result=(null)"); return NULL; } - TRACE_LOG1 ("truncated = %i", opd->result.truncated); + TRACE_LOG ("truncated = %i", opd->result.truncated); - TRACE_SUC1 ("result=%p", &opd->result); + TRACE_SUC ("result=%p", &opd->result); return &opd->result; } @@ -572,7 +572,7 @@ keylist_colon_handler (void *priv, char *line) key = opd->tmp_key; - TRACE2 (DEBUG_CTX, "gpgme:keylist_colon_handler", ctx, + TRACE (DEBUG_CTX, "gpgme:keylist_colon_handler", ctx, "key = %p, line = %s", key, line ? line : "(null)"); if (!line) @@ -1078,7 +1078,7 @@ gpgme_op_keylist_start (gpgme_ctx_t ctx, const char *pattern, int secret_only) op_data_t opd; int flags = 0; - TRACE_BEG2 (DEBUG_CTX, "gpgme_op_keylist_start", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_keylist_start", ctx, "pattern=%s, secret_only=%i", pattern, secret_only); if (!ctx) @@ -1122,7 +1122,7 @@ gpgme_op_keylist_ext_start (gpgme_ctx_t ctx, const char *pattern[], op_data_t opd; int flags = 0; - TRACE_BEG2 (DEBUG_CTX, "gpgme_op_keylist_ext_start", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_keylist_ext_start", ctx, "secret_only=%i, reserved=0x%x", secret_only, reserved); if (!ctx) @@ -1164,7 +1164,7 @@ gpgme_op_keylist_from_data_start (gpgme_ctx_t ctx, gpgme_data_t data, void *hook; op_data_t opd; - TRACE_BEG (DEBUG_CTX, "gpgme_op_keylist_from_data_start", ctx); + TRACE_BEG (DEBUG_CTX, "gpgme_op_keylist_from_data_start", ctx, ""); if (!ctx || !data || reserved) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); @@ -1199,7 +1199,7 @@ gpgme_op_keylist_next (gpgme_ctx_t ctx, gpgme_key_t *r_key) void *hook; op_data_t opd; - TRACE_BEG (DEBUG_CTX, "gpgme_op_keylist_next", ctx); + TRACE_BEG (DEBUG_CTX, "gpgme_op_keylist_next", ctx, ""); if (!ctx || !r_key) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); @@ -1235,7 +1235,7 @@ gpgme_op_keylist_next (gpgme_ctx_t ctx, gpgme_key_t *r_key) *r_key = queue_item->key; free (queue_item); - return TRACE_SUC2 ("key=%p (%s)", *r_key, + return TRACE_SUC ("key=%p (%s)", *r_key, ((*r_key)->subkeys && (*r_key)->subkeys->fpr) ? (*r_key)->subkeys->fpr : "invalid"); } @@ -1245,7 +1245,7 @@ gpgme_op_keylist_next (gpgme_ctx_t ctx, gpgme_key_t *r_key) gpgme_error_t gpgme_op_keylist_end (gpgme_ctx_t ctx) { - TRACE (DEBUG_CTX, "gpgme_op_keylist_end", ctx); + TRACE (DEBUG_CTX, "gpgme_op_keylist_end", ctx, ""); if (!ctx) return gpg_error (GPG_ERR_INV_VALUE); @@ -1264,7 +1264,7 @@ gpgme_get_key (gpgme_ctx_t ctx, const char *fpr, gpgme_key_t *r_key, gpgme_error_t err; gpgme_key_t result, key; - TRACE_BEG2 (DEBUG_CTX, "gpgme_get_key", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_get_key", ctx, "fpr=%s, secret=%i", fpr, secret); if (r_key) @@ -1335,7 +1335,7 @@ gpgme_get_key (gpgme_ctx_t ctx, const char *fpr, gpgme_key_t *r_key, if (! err) { *r_key = result; - TRACE_LOG2 ("key=%p (%s)", *r_key, + TRACE_LOG ("key=%p (%s)", *r_key, ((*r_key)->subkeys && (*r_key)->subkeys->fpr) ? (*r_key)->subkeys->fpr : "invalid"); } diff --git a/src/keysign.c b/src/keysign.c index 5cb47881..44ab5ff2 100644 --- a/src/keysign.c +++ b/src/keysign.c @@ -189,7 +189,7 @@ gpgme_op_keysign_start (gpgme_ctx_t ctx, gpgme_key_t key, const char *userid, { gpgme_error_t err; - TRACE_BEG3 (DEBUG_CTX, "gpgme_op_keysign_start", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_keysign_start", ctx, "key=%p, uid='%s' flags=0x%x", key, userid, flags); if (!ctx) @@ -206,7 +206,7 @@ gpgme_op_keysign (gpgme_ctx_t ctx, gpgme_key_t key, const char *userid, { gpgme_error_t err; - TRACE_BEG3 (DEBUG_CTX, "gpgme_op_keysign", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_keysign", ctx, "key=%p, uid='%s' flags=0x%x", key, userid, flags); if (!ctx) diff --git a/src/opassuan.c b/src/opassuan.c index c50ae557..bfb06869 100644 --- a/src/opassuan.c +++ b/src/opassuan.c @@ -91,7 +91,7 @@ gpgme_op_assuan_transact_start (gpgme_ctx_t ctx, { gpg_error_t err; - TRACE_BEG7 (DEBUG_CTX, "gpgme_op_assuan_transact_start", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_assuan_transact_start", ctx, "command=%s, data_cb=%p/%p, inq_cb=%p/%p, status_cb=%p/%p", command, data_cb, data_cb_value, inq_cb, inq_cb_value, status_cb, status_cb_value); @@ -120,7 +120,7 @@ gpgme_op_assuan_transact_ext (gpgme_ctx_t ctx, gpgme_error_t err; gpgme_error_t op_err; - TRACE_BEG8 (DEBUG_CTX, "gpgme_op_assuan_transact", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_assuan_transact", ctx, "command=%s, data_cb=%p/%p, inq_cb=%p/%p, status_cb=%p/%p, " "op_err=%p", command, data_cb, data_cb_value, inq_cb, inq_cb_value, @@ -139,7 +139,7 @@ gpgme_op_assuan_transact_ext (gpgme_ctx_t ctx, err = _gpgme_wait_one_ext (ctx, &op_err); if (op_err) { - TRACE_LOG2 ("op_err = %s <%s>", gpgme_strerror (op_err), + TRACE_LOG ("op_err = %s <%s>", gpgme_strerror (op_err), gpgme_strsource (op_err)); if (! op_err_p) { @@ -175,7 +175,7 @@ gpgme_op_assuan_result (gpgme_ctx_t ctx) void *hook; op_data_t opd; - TRACE_BEG (DEBUG_CTX, "gpgme_op_assuan_result", ctx); + TRACE_BEG (DEBUG_CTX, "gpgme_op_assuan_result", ctx, ""); err = _gpgme_op_data_lookup (ctx, OPDATA_ASSUAN, &hook, -1, NULL); opd = hook; @@ -183,7 +183,7 @@ gpgme_op_assuan_result (gpgme_ctx_t ctx) before. */ if (err || !opd) { - TRACE_SUC0 ("result=(null)"); + TRACE_SUC ("result=(null)"); return NULL; } @@ -192,15 +192,15 @@ gpgme_op_assuan_result (gpgme_ctx_t ctx) opd->result.err = _gpgme_engine_assuan_last_op_err (ctx->engine->engine); if (opd->result.err) { - TRACE_LOG1 ("err = %s", gpg_strerror (0)); + TRACE_LOG ("err = %s", gpg_strerror (0)); } else { - TRACE_LOG2 ("err = %s <%s>", gpg_strerror (opd->result.err), + TRACE_LOG ("err = %s <%s>", gpg_strerror (opd->result.err), gpg_strsource (opd->result.err)); } - TRACE_SUC1 ("result=%p", &opd->result); + TRACE_SUC ("result=%p", &opd->result); return &opd->result; } @@ -217,7 +217,7 @@ gpgme_op_assuan_transact (gpgme_ctx_t ctx, { gpgme_error_t err; - TRACE (DEBUG_CTX, "gpgme_op_assuan_transact", ctx); + TRACE (DEBUG_CTX, "gpgme_op_assuan_transact", ctx, ""); if (!ctx) return gpg_error (GPG_ERR_INV_VALUE); diff --git a/src/passwd.c b/src/passwd.c index 154ae287..0ba8c08d 100644 --- a/src/passwd.c +++ b/src/passwd.c @@ -173,7 +173,7 @@ gpgme_error_t gpgme_op_passwd_start (gpgme_ctx_t ctx, gpgme_key_t key, unsigned int flags) { gpg_error_t err; - TRACE_BEG2 (DEBUG_CTX, "gpgme_op_passwd_start", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_passwd_start", ctx, "key=%p, flags=0x%x", key, flags); if (!ctx) @@ -191,7 +191,7 @@ gpgme_op_passwd (gpgme_ctx_t ctx, gpgme_key_t key, unsigned int flags) { gpgme_error_t err; - TRACE_BEG2 (DEBUG_CTX, "gpgme_op_passwd", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_passwd", ctx, "key=%p, flags=0x%x", key, flags); if (!ctx) diff --git a/src/posix-io.c b/src/posix-io.c index 67c6e392..78f523b1 100644 --- a/src/posix-io.c +++ b/src/posix-io.c @@ -109,7 +109,7 @@ int _gpgme_io_read (int fd, void *buffer, size_t count) { int nread; - TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_read", fd, + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_read", fd, "buffer=%p, count=%u", buffer, count); do @@ -127,7 +127,7 @@ int _gpgme_io_write (int fd, const void *buffer, size_t count) { int nwritten; - TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_write", fd, + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_write", fd, "buffer=%p, count=%u", buffer, count); TRACE_LOGBUFX (buffer, count); @@ -146,7 +146,7 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx) { int saved_errno; int err; - TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_pipe", filedes, + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_pipe", filedes, "inherit_idx=%i (GPGME uses it for %s)", inherit_idx, inherit_idx ? "reading" : "writing"); @@ -166,7 +166,7 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx) if (err) return TRACE_SYSRES (err); - return TRACE_SUC2 ("read=0x%x, write=0x%x", filedes[0], filedes[1]); + return TRACE_SUC ("read=0x%x, write=0x%x", filedes[0], filedes[1]); } @@ -178,7 +178,7 @@ _gpgme_io_close (int fd) void *handler_value; int idx; - TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_close", fd); + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_close", fd, ""); if (fd == -1) { @@ -203,7 +203,7 @@ _gpgme_io_close (int fd) UNLOCK (notify_table_lock); if (handler) { - TRACE_LOG2 ("invoking close handler %p/%p", handler, handler_value); + TRACE_LOG ("invoking close handler %p/%p", handler, handler_value); handler (fd, handler_value); } @@ -220,7 +220,7 @@ _gpgme_io_set_close_notify (int fd, _gpgme_close_notify_handler_t handler, int res = 0; int idx; - TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_set_close_notify", fd, + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_set_close_notify", fd, "close_handler=%p/%p", handler, value); assert (fd != -1); @@ -271,7 +271,7 @@ _gpgme_io_set_nonblocking (int fd) { int flags; int res; - TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_set_nonblocking", fd); + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_set_nonblocking", fd, ""); flags = fcntl (fd, F_GETFL, 0); if (flags == -1) @@ -427,7 +427,7 @@ get_max_fds (void) } #endif - TRACE2 (DEBUG_SYSIO, "gpgme:max_fds", 0, "max fds=%i (%s)", fds, source); + TRACE (DEBUG_SYSIO, "gpgme:max_fds", 0, "max fds=%i (%s)", fds, source); return fds; } @@ -473,19 +473,19 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, int status; int signo; - TRACE_BEG1 (DEBUG_SYSIO, "_gpgme_io_spawn", path, + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_spawn", path, "path=%s", path); i = 0; while (argv[i]) { - TRACE_LOG2 ("argv[%2i] = %s", i, argv[i]); + TRACE_LOG ("argv[%2i] = %s", i, argv[i]); i++; } for (i = 0; fd_list[i].fd != -1; i++) if (fd_list[i].dup_to == -1) - TRACE_LOG2 ("fd[%i] = 0x%x", i, fd_list[i].fd); + TRACE_LOG ("fd[%i] = 0x%x", i, fd_list[i].fd); else - TRACE_LOG3 ("fd[%i] = 0x%x -> 0x%x", i, fd_list[i].fd, fd_list[i].dup_to); + TRACE_LOG ("fd[%i] = 0x%x -> 0x%x", i, fd_list[i].fd, fd_list[i].dup_to); pid = fork (); if (pid == -1) @@ -568,7 +568,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, #if 0 /* FIXME: The debug file descriptor is not dup'ed anyway, so we can't see this. */ - TRACE_LOG1 ("dup2 failed in child: %s\n", + TRACE_LOG ("dup2 failed in child: %s\n", strerror (errno)); #endif _exit (8); @@ -618,7 +618,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, _exit (0); } - TRACE_LOG1 ("waiting for child process pid=%i", pid); + TRACE_LOG ("waiting for child process pid=%i", pid); _gpgme_io_waitpid (pid, 1, &status, &signo); if (status) return TRACE_SYSRES (-1); @@ -653,7 +653,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock) /* Use a 1s timeout. */ struct timeval timeout = { 1, 0 }; void *dbg_help = NULL; - TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_select", fds, + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_select", fds, "nfds=%u, nonblock=%u", nfds, nonblock); FD_ZERO (&readfds); @@ -759,7 +759,7 @@ _gpgme_io_recvmsg (int fd, struct msghdr *msg, int flags) int nread; int saved_errno; struct iovec *iov; - TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_recvmsg", fd, + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_recvmsg", fd, "msg=%p, flags=%i", msg, flags); nread = 0; @@ -770,7 +770,7 @@ _gpgme_io_recvmsg (int fd, struct msghdr *msg, int flags) iov++; } - TRACE_LOG1 ("about to receive %d bytes", nread); + TRACE_LOG ("about to receive %d bytes", nread); do { @@ -801,7 +801,7 @@ _gpgme_io_sendmsg (int fd, const struct msghdr *msg, int flags) { int nwritten; struct iovec *iov; - TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_sendmsg", fd, + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_sendmsg", fd, "msg=%p, flags=%i", msg, flags); nwritten = 0; @@ -812,7 +812,7 @@ _gpgme_io_sendmsg (int fd, const struct msghdr *msg, int flags) iov++; } - TRACE_LOG1 ("about to receive %d bytes", nwritten); + TRACE_LOG ("about to receive %d bytes", nwritten); iov = msg->msg_iov; while (nwritten > 0) { @@ -840,7 +840,7 @@ _gpgme_io_dup (int fd) new_fd = dup (fd); while (new_fd == -1 && errno == EINTR); - TRACE1 (DEBUG_SYSIO, "_gpgme_io_dup", fd, "new fd==%i", new_fd); + TRACE (DEBUG_SYSIO, "_gpgme_io_dup", fd, "new fd==%i", new_fd); return new_fd; } @@ -851,7 +851,7 @@ _gpgme_io_socket (int domain, int type, int proto) { int res; - TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_socket", domain, + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_socket", domain, "type=%i, proto=%i", type, proto); res = socket (domain, type, proto); @@ -865,7 +865,7 @@ _gpgme_io_connect (int fd, struct sockaddr *addr, int addrlen) { int res; - TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_connect", fd, + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_connect", fd, "addr=%p, addrlen=%i", addr, addrlen); do diff --git a/src/queryswdb.c b/src/queryswdb.c index 537de39d..e72dabbc 100644 --- a/src/queryswdb.c +++ b/src/queryswdb.c @@ -58,18 +58,18 @@ gpgme_op_query_swdb_result (gpgme_ctx_t ctx) op_data_t opd; gpgme_error_t err; - TRACE_BEG (DEBUG_CTX, "gpgme_op_query_swdb_result", ctx); + TRACE_BEG (DEBUG_CTX, "gpgme_op_query_swdb_result", ctx, ""); err = _gpgme_op_data_lookup (ctx, OPDATA_QUERY_SWDB, &hook, -1, NULL); opd = hook; if (err || !opd) { - TRACE_SUC0 ("result=(null)"); + TRACE_SUC ("result=(null)"); return NULL; } - TRACE_SUC1 ("result=%p", &opd->result); + TRACE_SUC ("result=%p", &opd->result); return &opd->result; } @@ -91,8 +91,8 @@ gpgme_op_query_swdb (gpgme_ctx_t ctx, const char *name, const char *iversion, void *hook; op_data_t opd; - TRACE_BEG2 (DEBUG_CTX, "gpgme_op_query_swdb", ctx, - "name=%s, iversion=%a", name, iversion); + TRACE_BEG (DEBUG_CTX, "gpgme_op_query_swdb", ctx, + "name=%s, iversion=%", name, iversion); if (!ctx || reserved) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); diff --git a/src/sign.c b/src/sign.c index 49eac44c..31081aea 100644 --- a/src/sign.c +++ b/src/sign.c @@ -107,13 +107,13 @@ gpgme_op_sign_result (gpgme_ctx_t ctx) unsigned int inv_signers = 0; unsigned int signatures = 0; - TRACE_BEG (DEBUG_CTX, "gpgme_op_sign_result", ctx); + TRACE_BEG (DEBUG_CTX, "gpgme_op_sign_result", ctx, ""); err = _gpgme_op_data_lookup (ctx, OPDATA_SIGN, &hook, -1, NULL); opd = hook; if (err || !opd) { - TRACE_SUC0 ("result=(null)"); + TRACE_SUC ("result=(null)"); return NULL; } @@ -130,7 +130,7 @@ gpgme_op_sign_result (gpgme_ctx_t ctx) broken and should not be used. We add the already created signatures to the invalid signers list and thus this case can be detected. */ - TRACE_LOG3 ("result: invalid signers: %u, signatures: %u, count: %u", + TRACE_LOG ("result: invalid signers: %u, signatures: %u, count: %u", inv_signers, signatures, gpgme_signers_count (ctx)); for (sig = opd->result.signatures; sig; sig = sig->next) @@ -138,7 +138,7 @@ gpgme_op_sign_result (gpgme_ctx_t ctx) key = calloc (1, sizeof *key); if (!key) { - TRACE_SUC0 ("out of core; result=(null)"); + TRACE_SUC ("out of core; result=(null)"); return NULL; } if (sig->fpr) @@ -147,7 +147,7 @@ gpgme_op_sign_result (gpgme_ctx_t ctx) if (!key->fpr) { free (key); - TRACE_SUC0 ("out of core; result=(null)"); + TRACE_SUC ("out of core; result=(null)"); return NULL; } } @@ -170,24 +170,24 @@ gpgme_op_sign_result (gpgme_ctx_t ctx) if (_gpgme_debug_trace()) { - TRACE_LOG2 ("result: invalid signers: %i, signatures: %i", + TRACE_LOG ("result: invalid signers: %i, signatures: %i", inv_signers, signatures); for (inv_key=opd->result.invalid_signers; inv_key; inv_key=inv_key->next) { - TRACE_LOG3 ("result: invalid signer: fpr=%s, reason=%s <%s>", + TRACE_LOG ("result: invalid signer: fpr=%s, reason=%s <%s>", inv_key->fpr, gpgme_strerror (inv_key->reason), gpgme_strsource (inv_key->reason)); } for (sig = opd->result.signatures; sig; sig = sig->next) { - TRACE_LOG6 ("result: signature: type=%i, pubkey_algo=%i, " + TRACE_LOG ("result: signature: type=%i, pubkey_algo=%i, " "hash_algo=%i, timestamp=%li, fpr=%s, sig_class=%i", sig->type, sig->pubkey_algo, sig->hash_algo, sig->timestamp, sig->fpr, sig->sig_class); } } - TRACE_SUC1 ("result=%p", &opd->result); + TRACE_SUC ("result=%p", &opd->result); return &opd->result; } @@ -469,7 +469,7 @@ gpgme_op_sign_start (gpgme_ctx_t ctx, gpgme_data_t plain, gpgme_data_t sig, gpgme_sig_mode_t mode) { gpg_error_t err; - TRACE_BEG3 (DEBUG_CTX, "gpgme_op_sign_start", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_sign_start", ctx, "plain=%p, sig=%p, mode=%i", plain, sig, mode); if (!ctx) @@ -487,7 +487,7 @@ gpgme_op_sign (gpgme_ctx_t ctx, gpgme_data_t plain, gpgme_data_t sig, { gpgme_error_t err; - TRACE_BEG3 (DEBUG_CTX, "gpgme_op_sign", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_sign", ctx, "plain=%p, sig=%p, mode=%i", plain, sig, mode); if (!ctx) diff --git a/src/signers.c b/src/signers.c index fe2d6786..6a5ccd22 100644 --- a/src/signers.c +++ b/src/signers.c @@ -56,7 +56,7 @@ _gpgme_signers_clear (gpgme_ctx_t ctx) void gpgme_signers_clear (gpgme_ctx_t ctx) { - TRACE (DEBUG_CTX, "gpgme_signers_clear", ctx); + TRACE (DEBUG_CTX, "gpgme_signers_clear", ctx, ""); _gpgme_signers_clear (ctx); } @@ -65,7 +65,7 @@ gpgme_signers_clear (gpgme_ctx_t ctx) gpgme_error_t gpgme_signers_add (gpgme_ctx_t ctx, const gpgme_key_t key) { - TRACE_BEG2 (DEBUG_CTX, "gpgme_signers_add", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_signers_add", ctx, "key=%p (%s)", key, (key && key->subkeys && key->subkeys->fpr) ? key->subkeys->fpr : "invalid"); @@ -89,7 +89,7 @@ gpgme_signers_add (gpgme_ctx_t ctx, const gpgme_key_t key) gpgme_key_ref (key); ctx->signers[ctx->signers_len++] = key; - return TRACE_SUC (); + return TRACE_SUC (""); } diff --git a/src/spawn.c b/src/spawn.c index a4d5e8de..c5431b14 100644 --- a/src/spawn.c +++ b/src/spawn.c @@ -70,7 +70,7 @@ gpgme_op_spawn_start (gpgme_ctx_t ctx, const char *file, const char *argv[], { gpgme_error_t err; - TRACE_BEG2 (DEBUG_CTX, "gpgme_op_spawn_start", ctx, "file=(%s) flaggs=%x", + TRACE_BEG (DEBUG_CTX, "gpgme_op_spawn_start", ctx, "file=(%s) flaggs=%x", file, flags); if (!ctx) @@ -93,7 +93,7 @@ gpgme_op_spawn (gpgme_ctx_t ctx, const char *file, const char *argv[], { gpgme_error_t err; - TRACE_BEG2 (DEBUG_CTX, "gpgme_op_spawn", ctx, "file=(%s) flags=%x", + TRACE_BEG (DEBUG_CTX, "gpgme_op_spawn", ctx, "file=(%s) flags=%x", file, flags); if (!ctx) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); diff --git a/src/tofupolicy.c b/src/tofupolicy.c index 3ac9b8a6..79593186 100644 --- a/src/tofupolicy.c +++ b/src/tofupolicy.c @@ -155,7 +155,7 @@ gpgme_op_tofu_policy_start (gpgme_ctx_t ctx, gpgme_key_t key, gpgme_tofu_policy_t policy) { gpg_error_t err; - TRACE_BEG2 (DEBUG_CTX, "gpgme_op_tofu_policy_start", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_tofu_policy_start", ctx, "key=%p, policy=%u", key, (unsigned int)policy); if (!ctx) @@ -172,7 +172,7 @@ gpgme_op_tofu_policy (gpgme_ctx_t ctx, gpgme_key_t key, gpgme_tofu_policy_t policy) { gpgme_error_t err; - TRACE_BEG2 (DEBUG_CTX, "gpgme_op_tofu_policy", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_tofu_policy", ctx, "key=%p, policy=%u", key, (unsigned int)policy); if (!ctx) diff --git a/src/trustlist.c b/src/trustlist.c index 69f565a0..c7778379 100644 --- a/src/trustlist.c +++ b/src/trustlist.c @@ -177,7 +177,7 @@ gpgme_op_trustlist_start (gpgme_ctx_t ctx, const char *pattern, int max_level) void *hook; op_data_t opd; - TRACE_BEG2 (DEBUG_CTX, "gpgme_op_trustlist_start", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_trustlist_start", ctx, "pattern=%s, max_level=%i", pattern, max_level); if (!ctx || !pattern || !*pattern) @@ -213,7 +213,7 @@ gpgme_op_trustlist_next (gpgme_ctx_t ctx, gpgme_trust_item_t *r_item) op_data_t opd; struct trust_queue_item_s *q; - TRACE_BEG (DEBUG_CTX, "gpgme_op_trustlist_next", ctx); + TRACE_BEG (DEBUG_CTX, "gpgme_op_trustlist_next", ctx, ""); if (!ctx || !r_item) return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); @@ -245,20 +245,20 @@ gpgme_op_trustlist_next (gpgme_ctx_t ctx, gpgme_trust_item_t *r_item) free (q); if ((*r_item)->type == 1) { - TRACE_SUC5 ("trust_item=%p: %s: owner trust %s with level %i " + TRACE_SUC ("trust_item=%p: %s: owner trust %s with level %i " "and validity 0x%x", *r_item, (*r_item)->keyid, (*r_item)->owner_trust, (*r_item)->level, (*r_item)->validity); } else if ((*r_item)->type == 2) { - TRACE_SUC5 ("trust_item=%p: %s: UID %s with level %i " + TRACE_SUC ("trust_item=%p: %s: UID %s with level %i " "and validity 0x%x", *r_item, (*r_item)->keyid, (*r_item)->name, (*r_item)->level, (*r_item)->validity); } else { - TRACE_SUC5 ("trust_item=%p: %s: unknown type %i with level %i " + TRACE_SUC ("trust_item=%p: %s: unknown type %i with level %i " "and validity 0x%x", *r_item, (*r_item)->keyid, (*r_item)->type, (*r_item)->level, (*r_item)->validity); } @@ -270,7 +270,7 @@ gpgme_op_trustlist_next (gpgme_ctx_t ctx, gpgme_trust_item_t *r_item) gpgme_error_t gpgme_op_trustlist_end (gpgme_ctx_t ctx) { - TRACE (DEBUG_CTX, "gpgme_op_trustlist_end", ctx); + TRACE (DEBUG_CTX, "gpgme_op_trustlist_end", ctx, ""); if (!ctx) return gpg_error (GPG_ERR_INV_VALUE); diff --git a/src/verify.c b/src/verify.c index a80563a0..78e549ed 100644 --- a/src/verify.c +++ b/src/verify.c @@ -92,12 +92,12 @@ gpgme_op_verify_result (gpgme_ctx_t ctx) gpgme_error_t err; gpgme_signature_t sig; - TRACE_BEG (DEBUG_CTX, "gpgme_op_verify_result", ctx); + TRACE_BEG (DEBUG_CTX, "gpgme_op_verify_result", ctx, ""); err = _gpgme_op_data_lookup (ctx, OPDATA_VERIFY, &hook, -1, NULL); opd = hook; if (err || !opd) { - TRACE_SUC0 ("result=(null)"); + TRACE_SUC ("result=(null)"); return NULL; } @@ -133,30 +133,30 @@ gpgme_op_verify_result (gpgme_ctx_t ctx) for (sig = opd->result.signatures, i = 0; sig; sig = sig->next, i++) { - TRACE_LOG4 ("sig[%i] = fpr %s, summary 0x%x, status %s", + TRACE_LOG ("sig[%i] = fpr %s, summary 0x%x, status %s", i, sig->fpr, sig->summary, gpg_strerror (sig->status)); - TRACE_LOG6 ("sig[%i] = timestamps 0x%x/0x%x flags:%s%s%s", + TRACE_LOG ("sig[%i] = timestamps 0x%x/0x%x flags:%s%s%s", i, sig->timestamp, sig->exp_timestamp, sig->wrong_key_usage ? "wrong key usage" : "", sig->pka_trust == 1 ? "pka bad" : (sig->pka_trust == 2 ? "pka_okay" : "pka RFU"), sig->chain_model ? "chain model" : ""); - TRACE_LOG5 ("sig[%i] = validity 0x%x (%s), algos %s/%s", + TRACE_LOG ("sig[%i] = validity 0x%x (%s), algos %s/%s", i, sig->validity, gpg_strerror (sig->validity_reason), gpgme_pubkey_algo_name (sig->pubkey_algo), gpgme_hash_algo_name (sig->hash_algo)); if (sig->pka_address) { - TRACE_LOG2 ("sig[%i] = PKA address %s", i, sig->pka_address); + TRACE_LOG ("sig[%i] = PKA address %s", i, sig->pka_address); } if (sig->notations) { - TRACE_LOG1 ("sig[%i] = has notations (not shown)", i); + TRACE_LOG ("sig[%i] = has notations (not shown)", i); } } } - TRACE_SUC1 ("result=%p", &opd->result); + TRACE_SUC ("result=%p", &opd->result); return &opd->result; } @@ -1165,7 +1165,7 @@ gpgme_op_verify_start (gpgme_ctx_t ctx, gpgme_data_t sig, gpgme_data_t signed_text, gpgme_data_t plaintext) { gpg_error_t err; - TRACE_BEG3 (DEBUG_CTX, "gpgme_op_verify_start", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_verify_start", ctx, "sig=%p, signed_text=%p, plaintext=%p", sig, signed_text, plaintext); @@ -1185,7 +1185,7 @@ gpgme_op_verify (gpgme_ctx_t ctx, gpgme_data_t sig, gpgme_data_t signed_text, { gpgme_error_t err; - TRACE_BEG3 (DEBUG_CTX, "gpgme_op_verify", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_verify", ctx, "sig=%p, signed_text=%p, plaintext=%p", sig, signed_text, plaintext); diff --git a/src/version.c b/src/version.c index e1d8e592..8c35ed0e 100644 --- a/src/version.c +++ b/src/version.c @@ -202,7 +202,7 @@ gpgme_check_version (const char *req_version) before using the trace facility. If we won't the trace would automagically initialize the debug system with out the locks being initialized and missing the assuan log level setting. */ - TRACE2 (DEBUG_INIT, "gpgme_check_version", 0, + TRACE (DEBUG_INIT, "gpgme_check_version", 0, "req_version=%s, VERSION=%s", req_version? req_version:"(null)", VERSION); @@ -229,13 +229,13 @@ gpgme_check_version_internal (const char *req_version, return result; /* Catch-22, see above. */ - TRACE2 (DEBUG_INIT, "gpgme_check_version_internal", 0, + TRACE (DEBUG_INIT, "gpgme_check_version_internal", 0, "req_version=%s, offset_sig_validity=%i", req_version ? req_version : "(null)", offset_sig_validity); if (offset_sig_validity != offsetof (struct _gpgme_signature, validity)) { - TRACE1 (DEBUG_INIT, "gpgme_check_version_internal", 0, + TRACE (DEBUG_INIT, "gpgme_check_version_internal", 0, "offset_sig_validity mismatch: expected %i", offsetof (struct _gpgme_signature, validity)); _gpgme_selftest = GPG_ERR_SELFTEST_FAILED; diff --git a/src/vfs-create.c b/src/vfs-create.c index 1e23106a..51b8307c 100644 --- a/src/vfs-create.c +++ b/src/vfs-create.c @@ -179,7 +179,7 @@ gpgme_op_vfs_create (gpgme_ctx_t ctx, gpgme_key_t recp[], { gpg_error_t err; - TRACE_BEG3 (DEBUG_CTX, "gpgme_op_vfs_create", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_vfs_create", ctx, "container_file=%s, flags=0x%x, op_err=%p", container_file, flags, op_err); @@ -192,7 +192,7 @@ gpgme_op_vfs_create (gpgme_ctx_t ctx, gpgme_key_t recp[], while (recp[i]) { - TRACE_LOG3 ("recipient[%i] = %p (%s)", i, recp[i], + TRACE_LOG ("recipient[%i] = %p (%s)", i, recp[i], (recp[i]->subkeys && recp[i]->subkeys->fpr) ? recp[i]->subkeys->fpr : "invalid"); i++; diff --git a/src/vfs-mount.c b/src/vfs-mount.c index bb5f056c..c6ee7c97 100644 --- a/src/vfs-mount.c +++ b/src/vfs-mount.c @@ -234,7 +234,7 @@ gpgme_op_vfs_mount (gpgme_ctx_t ctx, const char *container_file, { gpg_error_t err; - TRACE_BEG4 (DEBUG_CTX, "gpgme_op_vfs_mount", ctx, + TRACE_BEG (DEBUG_CTX, "gpgme_op_vfs_mount", ctx, "container=%s, mount_dir=%s, flags=0x%x, op_err=%p", container_file, mount_dir, flags, op_err); diff --git a/src/w32-glib-io.c b/src/w32-glib-io.c index abd8045e..8c8722ce 100644 --- a/src/w32-glib-io.c +++ b/src/w32-glib-io.c @@ -231,13 +231,13 @@ _gpgme_io_fd2str (char *buf, int buflen, int fd) { HANDLE hndl; - TRACE_BEG1 (DEBUG_SYSIO, "_gpgme_io_fd2str", fd, "fd=%d", fd); + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_fd2str", fd, "fd=%d", fd); if (giochannel_table[fd].fd != -1) hndl = (HANDLE) _get_osfhandle (giochannel_table[fd].fd); else hndl = (HANDLE) giochannel_table[fd].socket; - TRACE_SUC1 ("syshd=%p", hndl); + TRACE_SUC ("syshd=%p", hndl); return snprintf (buf, buflen, "%d", (int) hndl); } @@ -263,7 +263,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count) gsize nread; GIOChannel *chan; GIOStatus status; - TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_read", fd, + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_read", fd, "buffer=%p, count=%u", buffer, count); chan = find_channel (fd); @@ -273,7 +273,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count) errno = EINVAL; return TRACE_SYSRES (-1); } - TRACE_LOG1 ("channel %p", chan); + TRACE_LOG ("channel %p", chan); { GError *err = NULL; @@ -281,7 +281,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count) count, &nread, &err); if (err) { - TRACE_LOG2 ("status %i, err %s", status, err->message); + TRACE_LOG ("status %i, err %s", status, err->message); g_error_free (err); } } @@ -295,7 +295,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count) } else if (status != G_IO_STATUS_NORMAL) { - TRACE_LOG1 ("status %d", status); + TRACE_LOG ("status %d", status); nread = -1; saved_errno = EIO; } @@ -317,7 +317,7 @@ _gpgme_io_write (int fd, const void *buffer, size_t count) GIOStatus status; GError *err = NULL; - TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_write", fd, + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_write", fd, "buffer=%p, count=%u", buffer, count); TRACE_LOGBUFX (buffer, count); @@ -333,7 +333,7 @@ _gpgme_io_write (int fd, const void *buffer, size_t count) &nwritten, &err); if (err) { - TRACE_LOG1 ("write error: %s", err->message); + TRACE_LOG ("write error: %s", err->message); g_error_free (err); } @@ -358,7 +358,7 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx) { int fds[2]; - TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_pipe", filedes, + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_pipe", filedes, "inherit_idx=%i (GPGME uses it for %s)", inherit_idx, inherit_idx ? "reading" : "writing"); @@ -421,7 +421,7 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx) return TRACE_SYSRES (-1); } - return TRACE_SUC5 ("read=0x%x/%p, write=0x%x/%p, channel=%p", + return TRACE_SUC ("read=0x%x/%p, write=0x%x/%p, channel=%p", filedes[0], (HANDLE) _get_osfhandle (giochannel_table[filedes[0]].fd), filedes[1], @@ -433,7 +433,7 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx) int _gpgme_io_close (int fd) { - TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_close", fd); + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_close", fd, ""); if (fd < 0 || fd >= MAX_SLAFD) { @@ -472,7 +472,7 @@ _gpgme_io_close (int fd) giochannel_table[fd].chan = NULL; giochannel_table[fd].primary = 0; - TRACE_SUC (); + TRACE_SUC (""); return 0; } @@ -481,7 +481,7 @@ int _gpgme_io_set_close_notify (int fd, _gpgme_close_notify_handler_t handler, void *value) { - TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_set_close_notify", fd, + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_set_close_notify", fd, "close_handler=%p/%p", handler, value); assert (fd != -1); @@ -503,7 +503,7 @@ _gpgme_io_set_nonblocking (int fd) GIOChannel *chan; GIOStatus status; - TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_set_nonblocking", fd); + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_set_nonblocking", fd, ""); chan = find_channel (fd); if (!chan) @@ -524,7 +524,7 @@ _gpgme_io_set_nonblocking (int fd) errno = EIO; return TRACE_SYSRES (-1); #else - TRACE_LOG1 ("g_io_channel_set_flags failed: status=%d (ignored)", + TRACE_LOG ("g_io_channel_set_flags failed: status=%d (ignored)", status); #endif } @@ -613,12 +613,12 @@ _gpgme_io_spawn (const char *path, char * const argv[], unsigned int flags, int tmp_fd; char *tmp_name; - TRACE_BEG1 (DEBUG_SYSIO, "_gpgme_io_spawn", path, + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_spawn", path, "path=%s", path); i = 0; while (argv[i]) { - TRACE_LOG2 ("argv[%2i] = %s", i, argv[i]); + TRACE_LOG ("argv[%2i] = %s", i, argv[i]); i++; } @@ -629,10 +629,10 @@ _gpgme_io_spawn (const char *path, char * const argv[], unsigned int flags, which gets the information from a temporary file. */ if (_gpgme_mkstemp (&tmp_fd, &tmp_name) < 0) { - TRACE_LOG1 ("_gpgme_mkstemp failed: %s", strerror (errno)); + TRACE_LOG ("_gpgme_mkstemp failed: %s", strerror (errno)); return TRACE_SYSRES (-1); } - TRACE_LOG1 ("tmp_name = %s", tmp_name); + TRACE_LOG ("tmp_name = %s", tmp_name); args = calloc (2 + i + 1, sizeof (*args)); args[0] = (char *) _gpgme_get_w32spawn_path (); @@ -675,7 +675,7 @@ _gpgme_io_spawn (const char *path, char * const argv[], unsigned int flags, &si, /* startup information */ &pi)) /* returns process information */ { - TRACE_LOG1 ("CreateProcess failed: ec=%d", (int) GetLastError ()); + TRACE_LOG ("CreateProcess failed: ec=%d", (int) GetLastError ()); free (arg_string); close (tmp_fd); DeleteFile (tmp_name); @@ -700,7 +700,7 @@ _gpgme_io_spawn (const char *path, char * const argv[], unsigned int flags, _get_osfhandle (giochannel_table[fd_list[i].fd].fd), pi.hProcess, &hd, 0, TRUE, DUPLICATE_SAME_ACCESS)) { - TRACE_LOG1 ("DuplicateHandle failed: ec=%d", (int) GetLastError ()); + TRACE_LOG ("DuplicateHandle failed: ec=%d", (int) GetLastError ()); TerminateProcess (pi.hProcess, 0); /* Just in case TerminateProcess didn't work, let the process fail on its own. */ @@ -763,7 +763,7 @@ _gpgme_io_spawn (const char *path, char * const argv[], unsigned int flags, /* The temporary file is deleted by the gpgme-w32spawn process (hopefully). */ - TRACE_LOG4 ("CreateProcess ready: hProcess=%p, hThread=%p, " + TRACE_LOG ("CreateProcess ready: hProcess=%p, hThread=%p, " "dwProcessID=%d, dwThreadId=%d", pi.hProcess, pi.hThread, (int) pi.dwProcessId, (int) pi.dwThreadId); @@ -772,17 +772,17 @@ _gpgme_io_spawn (const char *path, char * const argv[], unsigned int flags, *r_pid = (pid_t)pi.dwProcessId; if (ResumeThread (pi.hThread) < 0) - TRACE_LOG1 ("ResumeThread failed: ec=%d", (int) GetLastError ()); + TRACE_LOG ("ResumeThread failed: ec=%d", (int) GetLastError ()); if (!CloseHandle (pi.hThread)) - TRACE_LOG1 ("CloseHandle of thread failed: ec=%d", + TRACE_LOG ("CloseHandle of thread failed: ec=%d", (int) GetLastError ()); - TRACE_LOG1 ("process=%p", pi.hProcess); + TRACE_LOG ("process=%p", pi.hProcess); /* We don't need to wait for the process. */ if (!CloseHandle (pi.hProcess)) - TRACE_LOG1 ("CloseHandle of process failed: ec=%d", + TRACE_LOG ("CloseHandle of process failed: ec=%d", (int) GetLastError ()); if (! (flags & IOSPAWN_FLAG_NOCLOSE)) @@ -793,10 +793,10 @@ _gpgme_io_spawn (const char *path, char * const argv[], unsigned int flags, for (i = 0; fd_list[i].fd != -1; i++) if (fd_list[i].dup_to == -1) - TRACE_LOG3 ("fd[%i] = 0x%x -> 0x%x", i, fd_list[i].fd, + TRACE_LOG ("fd[%i] = 0x%x -> 0x%x", i, fd_list[i].fd, fd_list[i].peer_name); else - TRACE_LOG4 ("fd[%i] = 0x%x -> 0x%x (std%s)", i, fd_list[i].fd, + TRACE_LOG ("fd[%i] = 0x%x -> 0x%x (std%s)", i, fd_list[i].fd, fd_list[i].peer_name, (fd_list[i].dup_to == 0) ? "in" : ((fd_list[i].dup_to == 1) ? "out" : "err")); @@ -820,7 +820,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock) /* Use a 1s timeout. */ int timeout = 1000; void *dbg_help = NULL; - TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_select", fds, + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_select", fds, "nfds=%u, nonblock=%u", nfds, nonblock); if (nonblock) @@ -940,7 +940,7 @@ _gpgme_io_dup (int fd) int newfd; GIOChannel *chan; - TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_dup", fd); + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_dup", fd, ""); if (fd < 0 || fd >= MAX_SLAFD || !giochannel_table[fd].used) { @@ -997,7 +997,7 @@ _gpgme_io_socket (int domain, int type, int proto) int res; int fd; - TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_socket", domain, + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_socket", domain, "type=%i, protp=%i", type, proto); res = socket (domain, type, proto); @@ -1016,7 +1016,7 @@ _gpgme_io_socket (int domain, int type, int proto) return TRACE_SYSRES (-1); } - TRACE_SUC2 ("fd=%i, socket=0x%x", fd, res); + TRACE_SUC ("fd=%i, socket=0x%x", fd, res); return fd; } @@ -1032,7 +1032,7 @@ _gpgme_io_connect (int fd, struct sockaddr *addr, int addrlen) GIOStatus status; GError *err = NULL; - TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_connect", fd, + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_connect", fd, "addr=%p, addrlen=%i", addr, addrlen); chan = find_channel (fd); @@ -1048,7 +1048,7 @@ _gpgme_io_connect (int fd, struct sockaddr *addr, int addrlen) status = g_io_channel_set_flags (chan, flags & ~G_IO_FLAG_NONBLOCK, &err); if (err) { - TRACE_LOG1 ("setting flags error: %s", err->message); + TRACE_LOG ("setting flags error: %s", err->message); g_error_free (err); err = NULL; } @@ -1066,7 +1066,7 @@ _gpgme_io_connect (int fd, struct sockaddr *addr, int addrlen) return TRACE_SYSRES (-1); } - TRACE_LOG1 ("connect sockfd=0x%x", sockfd); + TRACE_LOG ("connect sockfd=0x%x", sockfd); res = connect (sockfd, addr, addrlen); /* FIXME: Error ignored here. */ @@ -1075,11 +1075,11 @@ _gpgme_io_connect (int fd, struct sockaddr *addr, int addrlen) if (res) { - TRACE_LOG2 ("connect failed: %i %i", res, WSAGetLastError ()); + TRACE_LOG ("connect failed: %i %i", res, WSAGetLastError ()); errno = wsa2errno (WSAGetLastError ()); return TRACE_SYSRES (-1); } - return TRACE_SUC (); + return TRACE_SUC (""); } diff --git a/src/w32-io.c b/src/w32-io.c index b4a03448..24e7e2ba 100644 --- a/src/w32-io.c +++ b/src/w32-io.c @@ -168,7 +168,7 @@ _close_handle (HANDLE hd, int line) { if (!CloseHandle (hd)) { - TRACE2 (DEBUG_INIT, "w32-io", hd, "CloseHandle failed at line %d: ec=%d", + TRACE (DEBUG_INIT, "w32-io", hd, "CloseHandle failed at line %d: ec=%d", line, (int) GetLastError ()); } } @@ -184,7 +184,7 @@ _wait_for_single_object (HANDLE hd, DWORD msec, int line) res = WaitForSingleObject (hd, msec); if (res == WAIT_FAILED) { - TRACE2 (DEBUG_INIT, "w32-io", hd, + TRACE (DEBUG_INIT, "w32-io", hd, "WFSO failed at line %d: ec=%d", line, (int) GetLastError ()); } return res; @@ -232,7 +232,7 @@ release_hddesc (hddesc_t hdd) { /* Holds a valid handle or was never initialized (in which case * REFCOUNT would be -1 here). */ - TRACE_BEG3 (DEBUG_SYSIO, "gpgme:release_hddesc", hdd, + TRACE_BEG (DEBUG_SYSIO, "gpgme:release_hddesc", hdd, "hd=%p, sock=%d, refcount=%d", hdd->hd, hdd->sock, hdd->refcount); @@ -241,15 +241,15 @@ release_hddesc (hddesc_t hdd) if (hdd->sock != INVALID_SOCKET) { - TRACE_LOG1 ("closing socket %d", hdd->sock); + TRACE_LOG ("closing socket %d", hdd->sock); if (closesocket (hdd->sock)) { - TRACE_LOG1 ("closesocket failed: ec=%d", (int)WSAGetLastError ()); + TRACE_LOG ("closesocket failed: ec=%d", (int)WSAGetLastError ()); } } free (hdd); - TRACE_SUC (); + TRACE_SUC (""); } UNLOCK (hddesc_lock); } @@ -331,12 +331,12 @@ get_desired_thread_priority (void) if (!_gpgme_get_conf_int ("IOThreadPriority", &value)) { value = THREAD_PRIORITY_HIGHEST; - TRACE1 (DEBUG_SYSIO, "gpgme:get_desired_thread_priority", 0, + TRACE (DEBUG_SYSIO, "gpgme:get_desired_thread_priority", 0, "%d (default)", value); } else { - TRACE1 (DEBUG_SYSIO, "gpgme:get_desired_thread_priority", 0, + TRACE (DEBUG_SYSIO, "gpgme:get_desired_thread_priority", 0, "%d (configured)", value); } return value; @@ -354,7 +354,7 @@ reader (void *arg) DWORD nread; int sock; - TRACE_BEG4 (DEBUG_SYSIO, "gpgme:reader", ctx->hdd, + TRACE_BEG (DEBUG_SYSIO, "gpgme:reader", ctx->hdd, "hd=%p, sock=%d, thread=%p, refcount=%d", ctx->hdd->hd, ctx->hdd->sock, ctx->thread_hd, ctx->refcount); @@ -373,10 +373,10 @@ reader (void *arg) /* Wait for space. */ if (!ResetEvent (ctx->have_space_ev)) { - TRACE_LOG1 ("ResetEvent failed: ec=%d", (int) GetLastError ()); + TRACE_LOG ("ResetEvent failed: ec=%d", (int) GetLastError ()); } UNLOCK (ctx->mutex); - TRACE_LOG1 ("waiting for space (refcnt=%d)", ctx->refcount); + TRACE_LOG ("waiting for space (refcnt=%d)", ctx->refcount); wait_for_single_object (ctx->have_space_ev, INFINITE); TRACE_LOG ("got space"); LOCK (ctx->mutex); @@ -392,7 +392,7 @@ reader (void *arg) nbytes = READBUF_SIZE - ctx->writepos; UNLOCK (ctx->mutex); - TRACE_LOG2 ("%s %d bytes", sock? "receiving":"reading", nbytes); + TRACE_LOG ("%s %d bytes", sock? "receiving":"reading", nbytes); if (sock) { @@ -425,7 +425,7 @@ reader (void *arg) } ctx->error = 1; - TRACE_LOG1 ("recv error: ec=%d", ctx->error_code); + TRACE_LOG ("recv error: ec=%d", ctx->error_code); } break; } @@ -450,7 +450,7 @@ reader (void *arg) else { ctx->error = 1; - TRACE_LOG1 ("read error: ec=%d", ctx->error_code); + TRACE_LOG ("read error: ec=%d", ctx->error_code); } break; } @@ -469,12 +469,12 @@ reader (void *arg) break; } - TRACE_LOG2 ("got %u bytes (refcnt=%d)", nread, ctx->refcount); + TRACE_LOG ("got %u bytes (refcnt=%d)", nread, ctx->refcount); ctx->writepos = (ctx->writepos + nread) % READBUF_SIZE; if (!SetEvent (ctx->have_data_ev)) { - TRACE_LOG2 ("SetEvent (0x%x) failed: ec=%d", ctx->have_data_ev, + TRACE_LOG ("SetEvent (0x%x) failed: ec=%d", ctx->have_data_ev, (int) GetLastError ()); } UNLOCK (ctx->mutex); @@ -482,7 +482,7 @@ reader (void *arg) /* Indicate that we have an error or EOF. */ if (!SetEvent (ctx->have_data_ev)) { - TRACE_LOG2 ("SetEvent (0x%x) failed: ec=%d", ctx->have_data_ev, + TRACE_LOG ("SetEvent (0x%x) failed: ec=%d", ctx->have_data_ev, (int) GetLastError ()); } @@ -497,7 +497,7 @@ reader (void *arg) DESTROY_LOCK (ctx->mutex); free (ctx); - return TRACE_SUC (); + return TRACE_SUC (""); } @@ -512,7 +512,7 @@ create_reader (hddesc_t hdd) SECURITY_ATTRIBUTES sec_attr; DWORD tid; - TRACE_BEG3 (DEBUG_SYSIO, "gpgme:create_reader", hdd, + TRACE_BEG (DEBUG_SYSIO, "gpgme:create_reader", hdd, "handle=%p sock=%d refhdd=%d", hdd->hd, hdd->sock, hdd->refcount); @@ -537,7 +537,7 @@ create_reader (hddesc_t hdd) ctx->close_ev = CreateEvent (&sec_attr, TRUE, FALSE, NULL); if (!ctx->have_data_ev || !ctx->have_space_ev || !ctx->close_ev) { - TRACE_LOG1 ("CreateEvent failed: ec=%d", (int) GetLastError ()); + TRACE_LOG ("CreateEvent failed: ec=%d", (int) GetLastError ()); if (ctx->have_data_ev) close_handle (ctx->have_data_ev); if (ctx->have_space_ev) @@ -556,7 +556,7 @@ create_reader (hddesc_t hdd) if (!ctx->thread_hd) { - TRACE_LOG1 ("CreateThread failed: ec=%d", (int) GetLastError ()); + TRACE_LOG ("CreateThread failed: ec=%d", (int) GetLastError ()); DESTROY_LOCK (ctx->mutex); if (ctx->have_data_ev) close_handle (ctx->have_data_ev); @@ -577,7 +577,7 @@ create_reader (hddesc_t hdd) SetThreadPriority (ctx->thread_hd, get_desired_thread_priority ()); } - TRACE_SUC (); + TRACE_SUC (""); return ctx; } @@ -592,7 +592,7 @@ destroy_reader (struct reader_context_s *ctx) ctx->refcount--; if (ctx->refcount != 0) { - TRACE2 (DEBUG_SYSIO, "gpgme:destroy_reader", ctx, + TRACE (DEBUG_SYSIO, "gpgme:destroy_reader", ctx, "hdd=%p refcount now %d", ctx->hdd, ctx->refcount); UNLOCK (ctx->mutex); return; @@ -600,7 +600,7 @@ destroy_reader (struct reader_context_s *ctx) ctx->stop_me = 1; if (ctx->have_space_ev) SetEvent (ctx->have_space_ev); - TRACE1 (DEBUG_SYSIO, "gpgme:destroy_reader", ctx, + TRACE (DEBUG_SYSIO, "gpgme:destroy_reader", ctx, "hdd=%p close triggered", ctx->hdd); UNLOCK (ctx->mutex); @@ -620,7 +620,7 @@ destroy_reader (struct reader_context_s *ctx) else if (ctx->hdd && ctx->hdd->sock != INVALID_SOCKET) { if (shutdown (ctx->hdd->sock, 2)) - TRACE2 (DEBUG_SYSIO, "gpgme:destroy_reader", ctx, + TRACE (DEBUG_SYSIO, "gpgme:destroy_reader", ctx, "shutdown socket %d failed: %s", ctx->hdd->sock, (int) WSAGetLastError ()); } @@ -646,7 +646,7 @@ find_reader (int fd) { UNLOCK (fd_table_lock); gpg_err_set_errno (EBADF); - TRACE_SUC0 ("EBADF"); + TRACE_SUC ("EBADF"); return NULL; } @@ -654,12 +654,12 @@ find_reader (int fd) if (rd) { UNLOCK (fd_table_lock); - TRACE_SUC1 ("rd=%p", rd); + TRACE_SUC ("rd=%p", rd); return rd; /* Return already initialized reader thread object. */ } /* Create a new reader thread. */ - TRACE_LOG3 ("fd=%d -> hdd=%p dupfrom=%d creating reader", + TRACE_LOG ("fd=%d -> hdd=%p dupfrom=%d creating reader", fd, fd_table[fd].hdd, fd_table[fd].dup_from); rd = create_reader (fd_table[fd].hdd); if (!rd) @@ -668,7 +668,7 @@ find_reader (int fd) fd_table[fd].reader = rd; UNLOCK (fd_table_lock); - TRACE_SUC1 ("rd=%p (new)", rd); + TRACE_SUC ("rd=%p (new)", rd); return rd; } @@ -678,7 +678,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count) { int nread; struct reader_context_s *ctx; - TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_read", fd, + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_read", fd, "buffer=%p, count=%u", buffer, count); ctx = find_reader (fd); @@ -692,9 +692,9 @@ _gpgme_io_read (int fd, void *buffer, size_t count) { /* No data available. */ UNLOCK (ctx->mutex); - TRACE_LOG1 ("waiting for data from thread %p", ctx->thread_hd); + TRACE_LOG ("waiting for data from thread %p", ctx->thread_hd); wait_for_single_object (ctx->have_data_ev, INFINITE); - TRACE_LOG1 ("data from thread %p available", ctx->thread_hd); + TRACE_LOG ("data from thread %p available", ctx->thread_hd); LOCK (ctx->mutex); } @@ -724,7 +724,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count) { if (!ResetEvent (ctx->have_data_ev)) { - TRACE_LOG1 ("ResetEvent failed: ec=%d", (int) GetLastError ()); + TRACE_LOG ("ResetEvent failed: ec=%d", (int) GetLastError ()); UNLOCK (ctx->mutex); /* FIXME: Should translate the error code. */ gpg_err_set_errno (EIO); @@ -733,7 +733,7 @@ _gpgme_io_read (int fd, void *buffer, size_t count) } if (!SetEvent (ctx->have_space_ev)) { - TRACE_LOG2 ("SetEvent (0x%x) failed: ec=%d", + TRACE_LOG ("SetEvent (0x%x) failed: ec=%d", ctx->have_space_ev, (int) GetLastError ()); UNLOCK (ctx->mutex); /* FIXME: Should translate the error code. */ @@ -756,7 +756,7 @@ writer (void *arg) struct writer_context_s *ctx = arg; DWORD nwritten; int sock; - TRACE_BEG4 (DEBUG_SYSIO, "gpgme:writer", ctx->hdd, + TRACE_BEG (DEBUG_SYSIO, "gpgme:writer", ctx->hdd, "hd=%p, sock=%d, thread=%p, refcount=%d", ctx->hdd->hd, ctx->hdd->sock, ctx->thread_hd, ctx->refcount); @@ -776,9 +776,9 @@ writer (void *arg) if (!ctx->nbytes) { if (!SetEvent (ctx->is_empty)) - TRACE_LOG1 ("SetEvent failed: ec=%d", (int) GetLastError ()); + TRACE_LOG ("SetEvent failed: ec=%d", (int) GetLastError ()); if (!ResetEvent (ctx->have_data)) - TRACE_LOG1 ("ResetEvent failed: ec=%d", (int) GetLastError ()); + TRACE_LOG ("ResetEvent failed: ec=%d", (int) GetLastError ()); UNLOCK (ctx->mutex); TRACE_LOG ("idle"); wait_for_single_object (ctx->have_data, INFINITE); @@ -792,7 +792,7 @@ writer (void *arg) } UNLOCK (ctx->mutex); - TRACE_LOG2 ("%s %d bytes", sock?"sending":"writing", ctx->nbytes); + TRACE_LOG ("%s %d bytes", sock?"sending":"writing", ctx->nbytes); /* Note that CTX->nbytes is not zero at this point, because _gpgme_io_write always writes at least 1 byte before waking @@ -808,7 +808,7 @@ writer (void *arg) { ctx->error_code = (int) WSAGetLastError (); ctx->error = 1; - TRACE_LOG1 ("send error: ec=%d", ctx->error_code); + TRACE_LOG ("send error: ec=%d", ctx->error_code); break; } nwritten = n; @@ -827,11 +827,11 @@ writer (void *arg) ctx->error_code = (int) GetLastError (); ctx->error = 1; - TRACE_LOG1 ("write error: ec=%d", ctx->error_code); + TRACE_LOG ("write error: ec=%d", ctx->error_code); break; } } - TRACE_LOG1 ("wrote %d bytes", (int) nwritten); + TRACE_LOG ("wrote %d bytes", (int) nwritten); LOCK (ctx->mutex); ctx->nbytes -= nwritten; @@ -839,13 +839,13 @@ writer (void *arg) } /* Indicate that we have an error. */ if (!SetEvent (ctx->is_empty)) - TRACE_LOG1 ("SetEvent failed: ec=%d", (int) GetLastError ()); + TRACE_LOG ("SetEvent failed: ec=%d", (int) GetLastError ()); TRACE_LOG ("waiting for close"); wait_for_single_object (ctx->close_ev, INFINITE); if (ctx->nbytes) - TRACE_LOG1 ("still %d bytes in buffer at close time", ctx->nbytes); + TRACE_LOG ("still %d bytes in buffer at close time", ctx->nbytes); release_hddesc (ctx->hdd); close_handle (ctx->close_ev); @@ -855,7 +855,7 @@ writer (void *arg) DESTROY_LOCK (ctx->mutex); free (ctx); - return TRACE_SUC (); + return TRACE_SUC (""); } @@ -867,7 +867,7 @@ create_writer (hddesc_t hdd) DWORD tid; -TRACE_BEG3 (DEBUG_SYSIO, "gpgme:create_writer", hdd, +TRACE_BEG (DEBUG_SYSIO, "gpgme:create_writer", hdd, "handle=%p sock=%d refhdd=%d", hdd->hd, hdd->sock, hdd->refcount); @@ -892,7 +892,7 @@ TRACE_BEG3 (DEBUG_SYSIO, "gpgme:create_writer", hdd, ctx->close_ev = CreateEvent (&sec_attr, TRUE, FALSE, NULL); if (!ctx->have_data || !ctx->is_empty || !ctx->close_ev) { - TRACE_LOG1 ("CreateEvent failed: ec=%d", (int) GetLastError ()); + TRACE_LOG ("CreateEvent failed: ec=%d", (int) GetLastError ()); if (ctx->have_data) close_handle (ctx->have_data); if (ctx->is_empty) @@ -910,7 +910,7 @@ TRACE_BEG3 (DEBUG_SYSIO, "gpgme:create_writer", hdd, ctx->thread_hd = CreateThread (&sec_attr, 0, writer, ctx, 0, &tid ); if (!ctx->thread_hd) { - TRACE_LOG1 ("CreateThread failed: ec=%d", (int) GetLastError ()); + TRACE_LOG ("CreateThread failed: ec=%d", (int) GetLastError ()); DESTROY_LOCK (ctx->mutex); if (ctx->have_data) close_handle (ctx->have_data); @@ -931,7 +931,7 @@ TRACE_BEG3 (DEBUG_SYSIO, "gpgme:create_writer", hdd, SetThreadPriority (ctx->thread_hd, get_desired_thread_priority ()); } - TRACE_SUC (); + TRACE_SUC (""); return ctx; } @@ -943,7 +943,7 @@ destroy_writer (struct writer_context_s *ctx) ctx->refcount--; if (ctx->refcount != 0) { - TRACE2 (DEBUG_SYSIO, "gpgme:destroy_writer", ctx, + TRACE (DEBUG_SYSIO, "gpgme:destroy_writer", ctx, "hdd=%p refcount now %d", ctx->hdd, ctx->refcount); UNLOCK (ctx->mutex); return; @@ -951,7 +951,7 @@ destroy_writer (struct writer_context_s *ctx) ctx->stop_me = 1; if (ctx->have_data) SetEvent (ctx->have_data); - TRACE1 (DEBUG_SYSIO, "gpgme:destroy_writer", ctx, + TRACE (DEBUG_SYSIO, "gpgme:destroy_writer", ctx, "hdd=%p close triggered", ctx->hdd); UNLOCK (ctx->mutex); @@ -978,7 +978,7 @@ find_writer (int fd) { UNLOCK (fd_table_lock); gpg_err_set_errno (EBADF); - TRACE_SUC0 ("EBADF"); + TRACE_SUC ("EBADF"); return NULL; } @@ -986,12 +986,12 @@ find_writer (int fd) if (wt) { UNLOCK (fd_table_lock); - TRACE_SUC1 ("wt=%p", wt); + TRACE_SUC ("wt=%p", wt); return wt; /* Return already initialized writer thread object. */ } /* Create a new writer thread. */ - TRACE_LOG4 ("fd=%d -> handle=%p socket=%d dupfrom=%d creating writer", + TRACE_LOG ("fd=%d -> handle=%p socket=%d dupfrom=%d creating writer", fd, fd_table[fd].hdd->hd, fd_table[fd].hdd->sock, fd_table[fd].dup_from); wt = create_writer (fd_table[fd].hdd); @@ -1001,7 +1001,7 @@ find_writer (int fd) fd_table[fd].writer = wt; UNLOCK (fd_table_lock); - TRACE_SUC1 ("wt=%p (new)", wt); + TRACE_SUC ("wt=%p (new)", wt); return wt; } @@ -1010,7 +1010,7 @@ int _gpgme_io_write (int fd, const void *buffer, size_t count) { struct writer_context_s *ctx; - TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_write", fd, + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_write", fd, "buffer=%p, count=%u", buffer, count); TRACE_LOGBUFX (buffer, count); @@ -1029,16 +1029,16 @@ _gpgme_io_write (int fd, const void *buffer, size_t count) /* Reset the is_empty event. Better safe than sorry. */ if (!ResetEvent (ctx->is_empty)) { - TRACE_LOG1 ("ResetEvent failed: ec=%d", (int) GetLastError ()); + TRACE_LOG ("ResetEvent failed: ec=%d", (int) GetLastError ()); UNLOCK (ctx->mutex); /* FIXME: Should translate the error code. */ gpg_err_set_errno (EIO); return TRACE_SYSRES (-1); } UNLOCK (ctx->mutex); - TRACE_LOG1 ("waiting for empty buffer in thread %p", ctx->thread_hd); + TRACE_LOG ("waiting for empty buffer in thread %p", ctx->thread_hd); wait_for_single_object (ctx->is_empty, INFINITE); - TRACE_LOG1 ("thread %p buffer is empty", ctx->thread_hd); + TRACE_LOG ("thread %p buffer is empty", ctx->thread_hd); LOCK (ctx->mutex); } @@ -1065,7 +1065,7 @@ _gpgme_io_write (int fd, const void *buffer, size_t count) * used by the select() implementation to probe the channel. */ if (!ResetEvent (ctx->is_empty)) { - TRACE_LOG1 ("ResetEvent failed: ec=%d", (int) GetLastError ()); + TRACE_LOG ("ResetEvent failed: ec=%d", (int) GetLastError ()); UNLOCK (ctx->mutex); /* FIXME: Should translate the error code. */ gpg_err_set_errno (EIO); @@ -1073,7 +1073,7 @@ _gpgme_io_write (int fd, const void *buffer, size_t count) } if (!SetEvent (ctx->have_data)) { - TRACE_LOG1 ("SetEvent failed: ec=%d", (int) GetLastError ()); + TRACE_LOG ("SetEvent failed: ec=%d", (int) GetLastError ()); UNLOCK (ctx->mutex); /* FIXME: Should translate the error code. */ gpg_err_set_errno (EIO); @@ -1096,7 +1096,7 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx) hddesc_t whdesc; SECURITY_ATTRIBUTES sec_attr; - TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_pipe", filedes, + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_pipe", filedes, "inherit_idx=%i (GPGME uses it for %s)", inherit_idx, inherit_idx ? "reading" : "writing"); @@ -1133,7 +1133,7 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx) if (!CreatePipe (&rh, &wh, &sec_attr, PIPEBUF_SIZE)) { - TRACE_LOG1 ("CreatePipe failed: ec=%d", (int) GetLastError ()); + TRACE_LOG ("CreatePipe failed: ec=%d", (int) GetLastError ()); release_fd (rfd); release_fd (wfd); release_hddesc (rhdesc); @@ -1150,7 +1150,7 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx) GetCurrentProcess(), &hd, 0, TRUE, DUPLICATE_SAME_ACCESS)) { - TRACE_LOG1 ("DuplicateHandle failed: ec=%d", + TRACE_LOG ("DuplicateHandle failed: ec=%d", (int) GetLastError ()); release_fd (rfd); release_fd (wfd); @@ -1171,7 +1171,7 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx) GetCurrentProcess(), &hd, 0, TRUE, DUPLICATE_SAME_ACCESS)) { - TRACE_LOG1 ("DuplicateHandle failed: ec=%d", + TRACE_LOG ("DuplicateHandle failed: ec=%d", (int) GetLastError ()); release_fd (rfd); release_fd (wfd); @@ -1200,7 +1200,7 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx) filedes[0] = rfd; filedes[1] = wfd; - return TRACE_SUC6 ("read=0x%x (hdd=%p,hd=%p), write=0x%x (hdd=%p,hd=%p)", + return TRACE_SUC ("read=0x%x (hdd=%p,hd=%p), write=0x%x (hdd=%p,hd=%p)", rfd, fd_table[rfd].hdd, fd_table[rfd].hdd->hd, wfd, fd_table[wfd].hdd, fd_table[wfd].hdd->hd); } @@ -1213,7 +1213,7 @@ _gpgme_io_close (int fd) _gpgme_close_notify_handler_t handler = NULL; void *value = NULL; - TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_close", fd); + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_close", fd, ""); if (fd < 0) { @@ -1231,18 +1231,18 @@ _gpgme_io_close (int fd) return TRACE_SYSRES (-1); } - TRACE_LOG2 ("hdd=%p dupfrom=%d", fd_table[fd].hdd, fd_table[fd].dup_from); + TRACE_LOG ("hdd=%p dupfrom=%d", fd_table[fd].hdd, fd_table[fd].dup_from); if (fd_table[fd].reader) { - TRACE_LOG1 ("destroying reader %p", fd_table[fd].reader); + TRACE_LOG ("destroying reader %p", fd_table[fd].reader); destroy_reader (fd_table[fd].reader); fd_table[fd].reader = NULL; } if (fd_table[fd].writer) { - TRACE_LOG1 ("destroying writer %p", fd_table[fd].writer); + TRACE_LOG ("destroying writer %p", fd_table[fd].writer); destroy_writer (fd_table[fd].writer); fd_table[fd].writer = NULL; } @@ -1280,7 +1280,7 @@ int _gpgme_io_set_close_notify (int fd, _gpgme_close_notify_handler_t handler, void *value) { - TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_set_close_notify", fd, + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_set_close_notify", fd, "close_handler=%p/%p", handler, value); LOCK (fd_table_lock); @@ -1301,7 +1301,7 @@ _gpgme_io_set_close_notify (int fd, _gpgme_close_notify_handler_t handler, int _gpgme_io_set_nonblocking (int fd) { - TRACE (DEBUG_SYSIO, "_gpgme_io_set_nonblocking", fd); + TRACE (DEBUG_SYSIO, "_gpgme_io_set_nonblocking", fd, ""); return 0; } @@ -1387,7 +1387,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, char *tmp_name; const char *spawnhelper; - TRACE_BEG1 (DEBUG_SYSIO, "_gpgme_io_spawn", path, + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_spawn", path, "path=%s", path); (void)atfork; @@ -1396,7 +1396,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, i = 0; while (argv[i]) { - TRACE_LOG2 ("argv[%2i] = %s", i, argv[i]); + TRACE_LOG ("argv[%2i] = %s", i, argv[i]); i++; } @@ -1407,10 +1407,10 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, which gets the information from a temporary file. */ if (_gpgme_mkstemp (&tmp_fd, &tmp_name) < 0) { - TRACE_LOG1 ("_gpgme_mkstemp failed: %s", strerror (errno)); + TRACE_LOG ("_gpgme_mkstemp failed: %s", strerror (errno)); return TRACE_SYSRES (-1); } - TRACE_LOG1 ("tmp_name = %s", tmp_name); + TRACE_LOG ("tmp_name = %s", tmp_name); args = calloc (2 + i + 1, sizeof (*args)); args[0] = (char *) _gpgme_get_w32spawn_path (); @@ -1485,7 +1485,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, &pi)) /* returns process information */ { int lasterr = (int)GetLastError (); - TRACE_LOG1 ("CreateProcess failed: ec=%d", lasterr); + TRACE_LOG ("CreateProcess failed: ec=%d", lasterr); free (arg_string); close (tmp_fd); DeleteFileA (tmp_name); @@ -1515,7 +1515,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, if (!DuplicateHandle (GetCurrentProcess(), ohd, pi.hProcess, &hd, 0, TRUE, DUPLICATE_SAME_ACCESS)) { - TRACE_LOG1 ("DuplicateHandle failed: ec=%d", (int) GetLastError ()); + TRACE_LOG ("DuplicateHandle failed: ec=%d", (int) GetLastError ()); TerminateProcess (pi.hProcess, 0); /* Just in case TerminateProcess didn't work, let the process fail on its own. */ @@ -1585,7 +1585,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, UNLOCK (fd_table_lock); - TRACE_LOG4 ("CreateProcess ready: hProcess=%p, hThread=%p, " + TRACE_LOG ("CreateProcess ready: hProcess=%p, hThread=%p, " "dwProcessID=%d, dwThreadId=%d", pi.hProcess, pi.hThread, (int) pi.dwProcessId, (int) pi.dwThreadId); @@ -1595,11 +1595,11 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, if (ResumeThread (pi.hThread) == (DWORD)(-1)) - TRACE_LOG1 ("ResumeThread failed: ec=%d", (int) GetLastError ()); + TRACE_LOG ("ResumeThread failed: ec=%d", (int) GetLastError ()); close_handle (pi.hThread); - TRACE_LOG1 ("process=%p", pi.hProcess); + TRACE_LOG ("process=%p", pi.hProcess); /* We don't need to wait for the process. */ close_handle (pi.hProcess); @@ -1612,10 +1612,10 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, for (i = 0; fd_list[i].fd != -1; i++) if (fd_list[i].dup_to == -1) - TRACE_LOG3 ("fd[%i] = 0x%x -> 0x%x", i, fd_list[i].fd, + TRACE_LOG ("fd[%i] = 0x%x -> 0x%x", i, fd_list[i].fd, fd_list[i].peer_name); else - TRACE_LOG4 ("fd[%i] = 0x%x -> 0x%x (std%s)", i, fd_list[i].fd, + TRACE_LOG ("fd[%i] = 0x%x -> 0x%x (std%s)", i, fd_list[i].fd, fd_list[i].peer_name, (fd_list[i].dup_to == 0) ? "in" : ((fd_list[i].dup_to == 1) ? "out" : "err")); @@ -1636,7 +1636,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock) int any; int count; void *dbg_help; - TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_select", fds, + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_select", fds, "nfds=%u, nonblock=%u", nfds, nonblock); #if 0 @@ -1660,7 +1660,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock) struct reader_context_s *ctx = find_reader (fds[i].fd); if (!ctx) - TRACE_LOG1 ("error: no reader for FD 0x%x (ignored)", + TRACE_LOG ("error: no reader for FD 0x%x (ignored)", fds[i].fd); else { @@ -1683,7 +1683,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock) struct writer_context_s *ctx = find_writer (fds[i].fd); if (!ctx) - TRACE_LOG1 ("error: no writer for FD 0x%x (ignored)", + TRACE_LOG ("error: no writer for FD 0x%x (ignored)", fds[i].fd); else { @@ -1745,7 +1745,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock) int k; int j = handle_to_fd (waitbuf[i]); - TRACE_LOG1 ("WFMO invalid handle %d removed", j); + TRACE_LOG ("WFMO invalid handle %d removed", j); for (k = 0 ; k < nfds; k++) { if (fds[k].fd == j) @@ -1757,12 +1757,12 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock) TRACE_LOG (" oops, or not???"); } #endif - TRACE_LOG1 ("WFMO failed: %d", le); + TRACE_LOG ("WFMO failed: %d", le); count = -1; } else { - TRACE_LOG1 ("WFMO returned %d", code); + TRACE_LOG ("WFMO returned %d", code); count = -1; } @@ -1817,7 +1817,7 @@ _gpgme_io_dup (int fd) struct writer_context_s *wt_ctx; int want_reader, want_writer; - TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_dup", fd); + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_dup", fd, ""); LOCK (fd_table_lock); if (fd < 0 || fd >= fd_table_size || !fd_table[fd].used) @@ -1912,7 +1912,7 @@ _gpgme_io_socket (int domain, int type, int proto) int fd; hddesc_t hdd; - TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_socket", domain, + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_socket", domain, "type=%i, protp=%i", type, proto); fd = new_fd(); @@ -1939,7 +1939,7 @@ _gpgme_io_socket (int domain, int type, int proto) fd_table[fd].want_reader = 1; fd_table[fd].want_writer = 1; - TRACE_SUC3 ("hdd=%p, socket=0x%x (0x%x)", hdd, fd, hdd->sock); + TRACE_SUC ("hdd=%p, socket=0x%x (0x%x)", hdd, fd, hdd->sock); return fd; } @@ -1951,7 +1951,7 @@ _gpgme_io_connect (int fd, struct sockaddr *addr, int addrlen) int res; int sock; - TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_connect", fd, + TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_connect", fd, "addr=%p, addrlen=%i", addr, addrlen); LOCK (fd_table_lock); @@ -1971,5 +1971,5 @@ _gpgme_io_connect (int fd, struct sockaddr *addr, int addrlen) return TRACE_SYSRES (-1); } - return TRACE_SUC (); + return TRACE_SUC (""); } diff --git a/src/w32-util.c b/src/w32-util.c index 7992b618..1f8ef6dc 100644 --- a/src/w32-util.c +++ b/src/w32-util.c @@ -220,19 +220,19 @@ _gpgme_allow_set_foreground_window (pid_t pid) if (!pid || pid == (pid_t)(-1)) { - TRACE1 (DEBUG_ENGINE, "gpgme:AllowSetForegroundWindow", 0, + TRACE (DEBUG_ENGINE, "gpgme:AllowSetForegroundWindow", 0, "no action for pid %d", (int)pid); } else if (func) { int rc = func (pid); - TRACE2 (DEBUG_ENGINE, "gpgme:AllowSetForegroundWindow", 0, + TRACE (DEBUG_ENGINE, "gpgme:AllowSetForegroundWindow", 0, "called for pid %d; result=%d", (int)pid, rc); } else { - TRACE0 (DEBUG_ENGINE, "gpgme:AllowSetForegroundWindow", 0, + TRACE (DEBUG_ENGINE, "gpgme:AllowSetForegroundWindow", 0, "function not available"); } #endif /* HAVE_ALLOW_SET_FOREGROUND_WINDOW */ @@ -268,13 +268,13 @@ _gpgme_w32_cancel_synchronous_io (HANDLE thread) { if (!func (thread) && GetLastError() != ERROR_NOT_FOUND) { - TRACE2 (DEBUG_ENGINE, "gpgme:CancelSynchronousIo", 0, + TRACE (DEBUG_ENGINE, "gpgme:CancelSynchronousIo", 0, "called for thread %p: ec=%d", thread, GetLastError ()); } } else { - TRACE0 (DEBUG_ENGINE, "gpgme:CancelSynchronousIo", 0, + TRACE (DEBUG_ENGINE, "gpgme:CancelSynchronousIo", 0, "function not available"); } } diff --git a/src/wait.c b/src/wait.c index a011b123..1da9e93d 100644 --- a/src/wait.c +++ b/src/wait.c @@ -136,7 +136,7 @@ _gpgme_add_io_cb (void *data, int fd, int dir, gpgme_io_cb_t fnc, return err; } - TRACE3 (DEBUG_CTX, "_gpgme_add_io_cb", ctx, + TRACE (DEBUG_CTX, "_gpgme_add_io_cb", ctx, "fd %d, dir=%d -> tag=%p", fd, dir, tag); *r_tag = tag; @@ -159,7 +159,7 @@ _gpgme_remove_io_cb (void *data) assert (fdt); idx = tag->idx; - TRACE2 (DEBUG_CTX, "_gpgme_remove_io_cb", data, + TRACE (DEBUG_CTX, "_gpgme_remove_io_cb", data, "setting fd 0x%x (item=%p) done", fdt->fds[idx].fd, fdt->fds[idx].opaque); @@ -196,7 +196,7 @@ _gpgme_run_io_cb (struct io_select_fd_s *an_fds, int checked, int nr; struct io_select_fd_s fds; - TRACE0 (DEBUG_CTX, "_gpgme_run_io_cb", item, "need to check"); + TRACE (DEBUG_CTX, "_gpgme_run_io_cb", item, "need to check"); fds = *an_fds; fds.signaled = 0; /* Just give it a quick poll. */ @@ -210,7 +210,7 @@ _gpgme_run_io_cb (struct io_select_fd_s *an_fds, int checked, return 0; } - TRACE2 (DEBUG_CTX, "_gpgme_run_io_cb", item, "handler (%p, %d)", + TRACE (DEBUG_CTX, "_gpgme_run_io_cb", item, "handler (%p, %d)", item->handler_value, an_fds->fd); iocb_data.handler_value = item->handler_value;