From 1646a612694b258c483caa081e6aee98168221f3 Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Mon, 27 Nov 2017 16:23:03 +0000 Subject: [PATCH] Add the missing debug macro The vital macro got lost from the earlier commit. --- mutt/debug.c | 15 +++++++++------ mutt/debug.h | 3 ++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/mutt/debug.c b/mutt/debug.c index 61fac8b47f5..a6e93848ef2 100644 --- a/mutt/debug.c +++ b/mutt/debug.c @@ -25,9 +25,9 @@ * * Output debugging messages, suitable for a developer. * - * | Function | Description - * | :----------- | :-------------------------------- - * | mutt_debug() | Output some debugging information + * | Function | Description + * | :---------------- | :-------------------------------- + * | mutt_debug_real() | Output some debugging information */ #include "config.h" @@ -35,7 +35,7 @@ #include /** - * mutt_debug - Output some debugging information + * mutt_debug_real - Output some debugging information * @param level Debug level * @param fmt printf-like formatting string * @param ... Arguments to be formatted @@ -43,10 +43,13 @@ * This stub function ignores the logging level and outputs all information to * stderr. */ -void mutt_debug(int level, const char *fmt, ...) +int mutt_debug_real(const char *function, const char *file, int line, int level, ...) { va_list ap; - va_start(ap, fmt); + va_start(ap, level); + const char *fmt = va_arg(ap, const char *); vfprintf(stderr, fmt, ap); + int ret = vfprintf(stderr, fmt, ap); va_end(ap); + return ret; } diff --git a/mutt/debug.h b/mutt/debug.h index 9208b9ee11b..eab26956ef8 100644 --- a/mutt/debug.h +++ b/mutt/debug.h @@ -24,7 +24,8 @@ #define _MUTT_DEBUG_H #ifdef DEBUG -void mutt_debug(int level, const char *fmt, ...); +int mutt_debug_real(const char *function, const char *file, int line, int level, ...); +#define mutt_debug(LEVEL, ...) mutt_debug_real(__func__, __FILE__, __LINE__, LEVEL, __VA_ARGS__) #else #define mutt_debug(...) do { } while (0) #endif