summaryrefslogtreecommitdiff
path: root/json-glib/json-debug.h
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2013-05-16 10:16:02 +0100
committerEmmanuele Bassi <ebassi@gnome.org>2013-05-16 10:16:02 +0100
commit72a3a8f71003d40087c59371d07df5b59f2df3a7 (patch)
tree07f10a6c74d6f5c5ded5b36ddcd15fa0adf38be5 /json-glib/json-debug.h
parent5b89c6438b8c1bf7a7b1476305a4e20f2c34234b (diff)
downloadjson-glib-72a3a8f71003d40087c59371d07df5b59f2df3a7.tar.gz
debug: Clean up debug flags accessor
Mark json_get_debug_flags() as an internal function, and drop the '_' prefix; also, add a simple macro that we can use everywhere to mask the function call.
Diffstat (limited to 'json-glib/json-debug.h')
-rw-r--r--json-glib/json-debug.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/json-glib/json-debug.h b/json-glib/json-debug.h
index 695917f..03ea96b 100644
--- a/json-glib/json-debug.h
+++ b/json-glib/json-debug.h
@@ -11,12 +11,14 @@ typedef enum {
JSON_DEBUG_PATH = 1 << 2
} JsonDebugFlags;
+#define JSON_HAS_DEBUG(flag) (json_get_debug_flags () & JSON_DEBUG_##flag)
+
#ifdef JSON_ENABLE_DEBUG
# ifdef __GNUC__
# define JSON_NOTE(type,x,a...) G_STMT_START { \
- if (_json_get_debug_flags () & JSON_DEBUG_##type) { \
+ if (JSON_HAS_DEBUG (type)) { \
g_message ("[" #type "] " G_STRLOC ": " x, ##a); \
} } G_STMT_END
@@ -26,7 +28,7 @@ typedef enum {
* do an intemediate printf.
*/
# define JSON_NOTE(type,...) G_STMT_START { \
- if (_json_get_debug_flags () & JSON_DEBUG_##type) { \
+ if (JSON_HAS_DEBUG (type)) { \
gchar * _fmt = g_strdup_printf (__VA_ARGS__); \
g_message ("[" #type "] " G_STRLOC ": %s",_fmt); \
g_free (_fmt); \
@@ -40,7 +42,8 @@ typedef enum {
#endif /* JSON_ENABLE_DEBUG */
-JsonDebugFlags _json_get_debug_flags (void);
+G_GNUC_INTERNAL
+JsonDebugFlags json_get_debug_flags (void);
G_END_DECLS