]> granicus.if.org Git - neomutt/commitdiff
Add the missing debug macro
authorRichard Russon <rich@flatcap.org>
Mon, 27 Nov 2017 16:23:03 +0000 (16:23 +0000)
committerRichard Russon <rich@flatcap.org>
Mon, 27 Nov 2017 16:40:12 +0000 (16:40 +0000)
The vital macro got lost from the earlier commit.

mutt/debug.c
mutt/debug.h

index 61fac8b47f5abb8c0d36840b56edb946702c6f89..a6e93848ef24f39b3692aa952be218099d4ccdb4 100644 (file)
@@ -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 <stdio.h>
 
 /**
- * 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
  * 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;
 }
index 9208b9ee11b5421874df485d3ed8b69a075b6954..eab26956ef84178cba920077fff312b7de819f5b 100644 (file)
@@ -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