summaryrefslogtreecommitdiffstats
path: root/mp_msg.h
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2011-06-29 09:51:49 +0300
committerUoti Urpala <uau@mplayer2.org>2011-06-29 09:51:49 +0300
commit9caae9b385a6de3f4dae98bebb1be64a997c1472 (patch)
tree40cc38748729fd2904a0ebe291bcca4d6915289a /mp_msg.h
parent4e1e23b2e92a756151d5c919057ad2fdad8996c2 (diff)
downloadmpv-9caae9b385a6de3f4dae98bebb1be64a997c1472.tar.bz2
mpv-9caae9b385a6de3f4dae98bebb1be64a997c1472.tar.xz
mp_msg: change mp_dbg() to inline function to check syntax
Change mp_dbg() from a macro that is defined to empty when MP_DEBUG is unset to an inline function that has an empty body when MP_DEBUG is unset. This allows the syntax of the calls to be checked even when compiling without MP_DEBUG set.
Diffstat (limited to 'mp_msg.h')
-rw-r--r--mp_msg.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/mp_msg.h b/mp_msg.h
index 7273b2a82d..7e2b4f29b5 100644
--- a/mp_msg.h
+++ b/mp_msg.h
@@ -140,16 +140,21 @@ void mp_msg_va(int mod, int lev, const char *format, va_list va);
#ifdef __GNUC__
void mp_msg(int mod, int lev, const char *format, ... ) __attribute__ ((format (printf, 3, 4)));
void mp_tmsg(int mod, int lev, const char *format, ... ) __attribute__ ((format (printf, 3, 4)));
+static inline void mp_dbg(int mod, int lev, const char *format, ...) __attribute__ ((format (printf, 3, 4)));
#else // not GNU C
void mp_msg(int mod, int lev, const char *format, ... );
void mp_tmsg(int mod, int lev, const char *format, ...)
#endif /* __GNUC__ */
+static inline void mp_dbg(int mod, int lev, const char *format, ...)
+{
#ifdef MP_DEBUG
-#define mp_dbg(mod,lev, ... ) mp_msg(mod, lev, __VA_ARGS__)
-#else
-#define mp_dbg(mod,lev, ... ) /* only useful for developers */
+ va_list va;
+ va_start(va, format);
+ mp_msg_va(mod, lev, format, va);
+ va_end(va);
#endif
+}
const char* filename_recode(const char* filename);