This commit is contained in:
Behdad Esfahbod 2012-05-11 00:52:16 +02:00
parent 6eec6f406d
commit 829e814ff3
1 changed files with 10 additions and 22 deletions

View File

@ -501,7 +501,7 @@ _hb_debug (unsigned int level,
#define DEBUG_LEVEL(WHAT, LEVEL) (_hb_debug ((LEVEL), HB_DEBUG_##WHAT)) #define DEBUG_LEVEL(WHAT, LEVEL) (_hb_debug ((LEVEL), HB_DEBUG_##WHAT))
#define DEBUG(WHAT) (DEBUG_LEVEL (WHAT, 0)) #define DEBUG(WHAT) (DEBUG_LEVEL (WHAT, 0))
template <int max_level> inline bool /* always returns TRUE */ template <int max_level> inline void
_hb_debug_msg_va (const char *what, _hb_debug_msg_va (const char *what,
const void *obj, const void *obj,
const char *func, const char *func,
@ -512,7 +512,7 @@ _hb_debug_msg_va (const char *what,
va_list ap) va_list ap)
{ {
if (!_hb_debug (level, max_level)) if (!_hb_debug (level, max_level))
return TRUE; return;
static const char bars[] = "││││││││││││││││││││││││││││││││││││││││"; static const char bars[] = "││││││││││││││││││││││││││││││││││││││││";
@ -538,10 +538,8 @@ _hb_debug_msg_va (const char *what,
vfprintf (stderr, message, ap); vfprintf (stderr, message, ap);
fprintf (stderr, "\n"); fprintf (stderr, "\n");
return TRUE;
} }
template <> inline bool /* always returns TRUE */ template <> inline void
_hb_debug_msg_va<0> (const char *what, _hb_debug_msg_va<0> (const char *what,
const void *obj, const void *obj,
const char *func, const char *func,
@ -549,12 +547,9 @@ _hb_debug_msg_va<0> (const char *what,
unsigned int level, unsigned int level,
int level_dir, int level_dir,
const char *message, const char *message,
va_list ap) va_list ap) {}
{
return TRUE;
}
template <int max_level> inline bool /* always returns TRUE */ template <int max_level> inline void
_hb_debug_msg (const char *what, _hb_debug_msg (const char *what,
const void *obj, const void *obj,
const char *func, const char *func,
@ -563,7 +558,7 @@ _hb_debug_msg (const char *what,
int level_dir, int level_dir,
const char *message, const char *message,
...) HB_PRINTF_FUNC(7, 8); ...) HB_PRINTF_FUNC(7, 8);
template <int max_level> inline bool /* always returns TRUE */ template <int max_level> inline void
_hb_debug_msg (const char *what, _hb_debug_msg (const char *what,
const void *obj, const void *obj,
const char *func, const char *func,
@ -575,14 +570,10 @@ _hb_debug_msg (const char *what,
{ {
va_list ap; va_list ap;
va_start (ap, message); va_start (ap, message);
_hb_debug_msg_va<max_level> (what, obj, func, indented, level, level_dir, message, ap);
bool ret = _hb_debug_msg_va<max_level> (what, obj, func, indented, level, level_dir, message, ap);
va_end (ap); va_end (ap);
return ret;
} }
template <> inline bool /* always returns TRUE */ template <> inline void
_hb_debug_msg<0> (const char *what, _hb_debug_msg<0> (const char *what,
const void *obj, const void *obj,
const char *func, const char *func,
@ -591,7 +582,7 @@ _hb_debug_msg<0> (const char *what,
int level_dir, int level_dir,
const char *message, const char *message,
...) HB_PRINTF_FUNC(7, 8); ...) HB_PRINTF_FUNC(7, 8);
template <> inline bool /* always returns TRUE */ template <> inline void
_hb_debug_msg<0> (const char *what, _hb_debug_msg<0> (const char *what,
const void *obj, const void *obj,
const char *func, const char *func,
@ -599,10 +590,7 @@ _hb_debug_msg<0> (const char *what,
unsigned int level, unsigned int level,
int level_dir, int level_dir,
const char *message, const char *message,
...) ...) {}
{
return TRUE;
}
#define DEBUG_MSG_LEVEL(WHAT, OBJ, LEVEL, LEVEL_DIR, ...) _hb_debug_msg<HB_DEBUG_##WHAT> (#WHAT, (OBJ), NULL, TRUE, (LEVEL), (LEVEL_DIR), __VA_ARGS__) #define DEBUG_MSG_LEVEL(WHAT, OBJ, LEVEL, LEVEL_DIR, ...) _hb_debug_msg<HB_DEBUG_##WHAT> (#WHAT, (OBJ), NULL, TRUE, (LEVEL), (LEVEL_DIR), __VA_ARGS__)
#define DEBUG_MSG(WHAT, OBJ, ...) _hb_debug_msg<HB_DEBUG_##WHAT> (#WHAT, (OBJ), NULL, FALSE, 0, 0, __VA_ARGS__) #define DEBUG_MSG(WHAT, OBJ, ...) _hb_debug_msg<HB_DEBUG_##WHAT> (#WHAT, (OBJ), NULL, FALSE, 0, 0, __VA_ARGS__)