mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-05-18 11:41:58 +02:00
Use glib infrastructure to parse debug flags
Proposed in bug 623319
This commit is contained in:
parent
29850d03e8
commit
33f7f6a748
@ -1180,7 +1180,7 @@ _g_dbus_worker_flush_sync (GDBusWorker *worker,
|
|||||||
#define G_DBUS_DEBUG_INCOMING (1<<5)
|
#define G_DBUS_DEBUG_INCOMING (1<<5)
|
||||||
#define G_DBUS_DEBUG_EMISSION (1<<6)
|
#define G_DBUS_DEBUG_EMISSION (1<<6)
|
||||||
#define G_DBUS_DEBUG_ADDRESS (1<<7)
|
#define G_DBUS_DEBUG_ADDRESS (1<<7)
|
||||||
#define G_DBUS_DEBUG_ALL 0xffffffff
|
|
||||||
static gint _gdbus_debug_flags = 0;
|
static gint _gdbus_debug_flags = 0;
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
@ -1276,31 +1276,20 @@ _g_dbus_initialize (void)
|
|||||||
debug = g_getenv ("G_DBUS_DEBUG");
|
debug = g_getenv ("G_DBUS_DEBUG");
|
||||||
if (debug != NULL)
|
if (debug != NULL)
|
||||||
{
|
{
|
||||||
gchar **tokens;
|
const GDebugKey keys[] = {
|
||||||
guint n;
|
{ "authentication", G_DBUS_DEBUG_AUTHENTICATION },
|
||||||
tokens = g_strsplit (debug, ",", 0);
|
{ "message", G_DBUS_DEBUG_MESSAGE },
|
||||||
for (n = 0; tokens[n] != NULL; n++)
|
{ "payload", G_DBUS_DEBUG_PAYLOAD },
|
||||||
{
|
{ "call", G_DBUS_DEBUG_CALL },
|
||||||
if (g_strcmp0 (tokens[n], "authentication") == 0)
|
{ "signal", G_DBUS_DEBUG_SIGNAL },
|
||||||
_gdbus_debug_flags |= G_DBUS_DEBUG_AUTHENTICATION;
|
{ "incoming", G_DBUS_DEBUG_INCOMING },
|
||||||
else if (g_strcmp0 (tokens[n], "message") == 0)
|
{ "emission", G_DBUS_DEBUG_EMISSION },
|
||||||
_gdbus_debug_flags |= G_DBUS_DEBUG_MESSAGE;
|
{ "address", G_DBUS_DEBUG_ADDRESS }
|
||||||
else if (g_strcmp0 (tokens[n], "payload") == 0) /* implies `message' */
|
};
|
||||||
_gdbus_debug_flags |= (G_DBUS_DEBUG_MESSAGE | G_DBUS_DEBUG_PAYLOAD);
|
|
||||||
else if (g_strcmp0 (tokens[n], "call") == 0)
|
_gdbus_debug_flags = g_parse_debug_string (debug, keys, G_N_ELEMENTS (keys));
|
||||||
_gdbus_debug_flags |= G_DBUS_DEBUG_CALL;
|
if (_gdbus_debug_flags & G_DBUS_DEBUG_PAYLOAD)
|
||||||
else if (g_strcmp0 (tokens[n], "signal") == 0)
|
_gdbus_debug_flags |= G_DBUS_DEBUG_MESSAGE;
|
||||||
_gdbus_debug_flags |= G_DBUS_DEBUG_SIGNAL;
|
|
||||||
else if (g_strcmp0 (tokens[n], "incoming") == 0)
|
|
||||||
_gdbus_debug_flags |= G_DBUS_DEBUG_INCOMING;
|
|
||||||
else if (g_strcmp0 (tokens[n], "emission") == 0)
|
|
||||||
_gdbus_debug_flags |= G_DBUS_DEBUG_EMISSION;
|
|
||||||
else if (g_strcmp0 (tokens[n], "address") == 0)
|
|
||||||
_gdbus_debug_flags |= G_DBUS_DEBUG_ADDRESS;
|
|
||||||
else if (g_strcmp0 (tokens[n], "all") == 0)
|
|
||||||
_gdbus_debug_flags |= G_DBUS_DEBUG_ALL;
|
|
||||||
}
|
|
||||||
g_strfreev (tokens);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_once_init_leave (&initialized, 1);
|
g_once_init_leave (&initialized, 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user