1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
#if !defined (WOCKY_COMPILATION)
# error "This is an internal header."
#endif
#ifndef WOCKY_DEBUG_INTERNAL_H
#define WOCKY_DEBUG_INTERNAL_H
#include "config.h"
#include <glib.h>
#include "wocky-debug.h"
#include "wocky-stanza.h"
G_BEGIN_DECLS
#ifdef ENABLE_DEBUG
void wocky_debug_set_flags_from_env (void);
gboolean wocky_debug_flag_is_set (WockyDebugFlags flag);
void wocky_debug_valist (WockyDebugFlags flag,
const gchar *format, va_list args);
void wocky_debug (WockyDebugFlags flag, const gchar *format, ...)
G_GNUC_PRINTF (2, 3);
void wocky_debug_stanza (WockyDebugFlags flag, WockyStanza *stanza,
const gchar *format, ...)
G_GNUC_PRINTF (3, 4);
void wocky_debug_node_tree (WockyDebugFlags flag, WockyNodeTree *tree,
const gchar *format, ...)
G_GNUC_PRINTF (3, 4);
#ifdef DEBUG_FLAG
#define DEBUG(format, ...) \
wocky_debug (DEBUG_FLAG, "%s: %s: " format, G_STRFUNC, G_STRLOC, \
##__VA_ARGS__)
#define DEBUG_STANZA(stanza, format, ...) \
wocky_debug_stanza (DEBUG_FLAG, stanza, "%s: " format, G_STRFUNC,\
##__VA_ARGS__)
#define DEBUG_NODE_TREE(tree, format, ...) \
wocky_debug_node_tree (DEBUG_FLAG, tree, "%s: " format, G_STRFUNC,\
##__VA_ARGS__)
#define DEBUGGING wocky_debug_flag_is_set(DEBUG_FLAG)
#endif /* DEBUG_FLAG */
#else /* ENABLE_DEBUG */
#ifdef DEBUG_FLAG
static inline void
DEBUG (
const gchar *format,
...)
{
/* blah blah blah */
}
static inline void
DEBUG_STANZA (WockyStanza *stanza,
const gchar *format,
...)
{
}
static inline void
DEBUG_NODE_TREE (WockyNodeTree *tree,
const gchar *format,
...)
{
}
#define DEBUGGING 0
#endif /* DEBUG_FLAG */
#endif /* ENABLE_DEBUG */
G_END_DECLS
#endif
|