1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

common: Change argument order of log_printhex.

* common/logging.c (log_printhex): Chnage order of args.  Make it
printf alike.  Change all callers.
* configure.ac: Add -Wno-format-zero-length
--

This makes it consistent with modern libgpgrt logging and thus eases
back porting from newer GnuPG versions which use libgpgrt logging.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2020-05-12 18:51:47 +02:00
parent aec7d136e4
commit c6324ee07a
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
26 changed files with 84 additions and 76 deletions

View file

@ -1011,10 +1011,17 @@ log_flush (void)
dump, with TEXT just an empty string, print a trailing linefeed,
otherwise print an entire debug line. */
void
log_printhex (const char *text, const void *buffer, size_t length)
log_printhex (const void *buffer, size_t length, const char *fmt, ...)
{
if (text && *text)
log_debug ("%s ", text);
if (fmt && *fmt)
{
va_list arg_ptr ;
va_start (arg_ptr, fmt);
do_logv (GPGRT_LOG_DEBUG, 0, NULL, NULL, fmt, arg_ptr);
va_end (arg_ptr);
log_printf (" ");
}
if (length)
{
const unsigned char *p = buffer;
@ -1022,7 +1029,7 @@ log_printhex (const char *text, const void *buffer, size_t length)
for (length--, p++; length--; p++)
log_printf (" %02X", *p);
}
if (text)
if (fmt)
log_printf ("\n");
}

View file

@ -103,11 +103,12 @@ void log_debug_with_string (const char *string, const char *fmt,
void log_printf (const char *fmt, ...) GPGRT_ATTR_PRINTF(1,2);
void log_flush (void);
/* Print a hexdump of BUFFER. With TEXT passes as NULL print just the
raw dump, with TEXT being an empty string, print a trailing
linefeed, otherwise print an entire debug line with TEXT followed
by the hexdump and a final LF. */
void log_printhex (const char *text, const void *buffer, size_t length);
/* Print a hexdump of BUFFER. With FMT passed as NULL print just the
* raw dump, with FMT being an empty string, print a trailing
* linefeed, otherwise print an entire debug line with expanded FMT
* followed by the hexdump and a final LF. */
void log_printhex (const void *buffer, size_t length,
const char *fmt, ...) GPGRT_ATTR_PRINTF(3,4);
void log_clock (const char *string);