1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-26 00:42:57 +00:00

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.
This commit is contained in:
Uoti Urpala 2011-06-29 09:51:49 +03:00
parent 4e1e23b2e9
commit 9caae9b385

View File

@ -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);