From 37b70a97331a4b9896e557c938c5151b63894aff Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 19 Apr 2016 23:23:59 -0400 Subject: [PATCH] Use qdata for debug flags This avoids some overhead. --- gtk/gtkmain.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index f3d35eb9d5..9a3b4ece7b 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -158,6 +158,7 @@ static GSList *main_loops = NULL; /* stack of currently executing main loop static GSList *key_snoopers = NULL; static guint debug_flags = 0; /* Global GTK debug flag */ +static GQuark quark_debug_flags = 0; #ifdef G_ENABLE_DEBUG static const GDebugKey gtk_debug_keys[] = { @@ -738,6 +739,8 @@ do_post_parse_initialization (int *argc, _gtk_accel_map_init (); + quark_debug_flags = g_quark_from_static_string ("gtk-debug-flags"); + gtk_initialized = TRUE; if (gtk_modules_string) @@ -809,7 +812,7 @@ guint gtk_get_display_debug_flags (GdkDisplay *display) { if (display) - return GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (display), "gtk-debug-flags")); + return GPOINTER_TO_UINT (g_object_get_qdata (G_OBJECT (display), quark_debug_flags)); else return debug_flags; } @@ -819,7 +822,7 @@ gtk_set_display_debug_flags (GdkDisplay *display, guint flags) { if (display) - g_object_set_data (G_OBJECT (display), "gtk-debug-flags", GUINT_TO_POINTER (flags)); + g_object_set_qdata (G_OBJECT (display), quark_debug_flags, GUINT_TO_POINTER (flags)); else debug_flags = flags; }