/src/tinysparql/subprojects/json-glib-1.10.6/json-glib/json-debug.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* json-debug.c: Logging utilities |
2 | | * |
3 | | * This file is part of JSON-GLib. |
4 | | * |
5 | | * SPDX-FileCopyrightText: 2010 Emmanuele Bassi |
6 | | * SPDX-License-Identifier: LGPL-2.1-or-later |
7 | | */ |
8 | | |
9 | | #include "config.h" |
10 | | |
11 | | #include "json-debug.h" |
12 | | |
13 | | static unsigned int json_debug_flags = 0; |
14 | | |
15 | | #ifdef JSON_ENABLE_DEBUG |
16 | | static const GDebugKey json_debug_keys[] = { |
17 | | { "parser", JSON_DEBUG_PARSER }, |
18 | | { "gobject", JSON_DEBUG_GOBJECT }, |
19 | | { "path", JSON_DEBUG_PATH }, |
20 | | { "node", JSON_DEBUG_NODE }, |
21 | | }; |
22 | | #endif /* JSON_ENABLE_DEBUG */ |
23 | | |
24 | | JsonDebugFlags |
25 | | json_get_debug_flags (void) |
26 | 0 | { |
27 | 0 | #ifdef JSON_ENABLE_DEBUG |
28 | 0 | static gboolean json_debug_flags_set; |
29 | 0 | const gchar *env_str; |
30 | |
|
31 | 0 | if (G_LIKELY (json_debug_flags_set)) |
32 | 0 | return json_debug_flags; |
33 | | |
34 | 0 | env_str = g_getenv ("JSON_DEBUG"); |
35 | 0 | if (env_str != NULL && *env_str != '\0') |
36 | 0 | { |
37 | 0 | json_debug_flags |= g_parse_debug_string (env_str, |
38 | 0 | json_debug_keys, |
39 | 0 | G_N_ELEMENTS (json_debug_keys)); |
40 | 0 | } |
41 | |
|
42 | 0 | json_debug_flags_set = TRUE; |
43 | 0 | #endif /* JSON_ENABLE_DEBUG */ |
44 | |
|
45 | 0 | return json_debug_flags; |
46 | 0 | } |