/src/json-glib/json-glib/json-debug.c
Line | Count | Source (jump to first uncovered line) |
1 | | #include "config.h" |
2 | | |
3 | | #include "json-debug.h" |
4 | | |
5 | | static unsigned int json_debug_flags = 0; |
6 | | |
7 | | #ifdef JSON_ENABLE_DEBUG |
8 | | static const GDebugKey json_debug_keys[] = { |
9 | | { "parser", JSON_DEBUG_PARSER }, |
10 | | { "gobject", JSON_DEBUG_GOBJECT }, |
11 | | { "path", JSON_DEBUG_PATH }, |
12 | | { "node", JSON_DEBUG_NODE }, |
13 | | }; |
14 | | #endif /* JSON_ENABLE_DEBUG */ |
15 | | |
16 | | JsonDebugFlags |
17 | | json_get_debug_flags (void) |
18 | 0 | { |
19 | 0 | #ifdef JSON_ENABLE_DEBUG |
20 | 0 | static gboolean json_debug_flags_set; |
21 | 0 | const gchar *env_str; |
22 | |
|
23 | 0 | if (G_LIKELY (json_debug_flags_set)) |
24 | 0 | return json_debug_flags; |
25 | | |
26 | 0 | env_str = g_getenv ("JSON_DEBUG"); |
27 | 0 | if (env_str != NULL && *env_str != '\0') |
28 | 0 | { |
29 | 0 | json_debug_flags |= g_parse_debug_string (env_str, |
30 | 0 | json_debug_keys, |
31 | 0 | G_N_ELEMENTS (json_debug_keys)); |
32 | 0 | } |
33 | |
|
34 | 0 | json_debug_flags_set = TRUE; |
35 | 0 | #endif /* JSON_ENABLE_DEBUG */ |
36 | |
|
37 | 0 | return json_debug_flags; |
38 | 0 | } |