[Xfce4-commits] <midori:master> Exact debug token check and verify tokens are listed
Christian Dywan
noreply at xfce.org
Mon Aug 27 21:54:01 CEST 2012
Updating branch refs/heads/master
to f41498e16ced1c2b8804dae033f2354dd688f0af (commit)
from b5ff08c4c0e7ee19ebf73b9ecb4dcfe7af699ca8 (commit)
commit f41498e16ced1c2b8804dae033f2354dd688f0af
Author: Christian Dywan <christian at twotoasts.de>
Date: Sun Aug 26 14:16:14 2012 +0200
Exact debug token check and verify tokens are listed
midori/midori-app.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/midori/midori-app.c b/midori/midori-app.c
index 1c87460..f73fe8f 100644
--- a/midori/midori-app.c
+++ b/midori/midori-app.c
@@ -1566,13 +1566,13 @@ gboolean
midori_debug (const gchar* token)
{
static const gchar* debug_token = NULL;
- g_return_val_if_fail (token != NULL, FALSE);
+ const gchar* debug = g_getenv ("MIDORI_DEBUG");
+ const gchar* debug_tokens = "soup soup:1 soup:2 soup:3 cookies ";
+ const gchar* full_debug_tokens = "adblock:1 adblock:2 startup bookmarks ";
if (debug_token == NULL)
{
- const gchar* debug = g_getenv ("MIDORI_DEBUG");
- const gchar* debug_tokens = "soup:1 soup:2 soup:3 cookies";
- const gchar* full_debug_tokens = "adblock:1 adblock:2 startup bookmarks";
- if (debug && strstr (full_debug_tokens, debug))
+ gchar* found_token;
+ if (debug && (found_token = strstr (full_debug_tokens, debug)) && *found_token == ' ')
{
#ifdef G_ENABLE_DEBUG
debug_token = g_intern_static_string (debug);
@@ -1580,7 +1580,7 @@ midori_debug (const gchar* token)
g_warning ("Value '%s' for MIDORI_DEBUG requires a full debugging build.", debug);
#endif
}
- else if (debug && strstr (debug_tokens, debug))
+ else if (debug && (found_token = strstr (debug_tokens, debug)) && *found_token == ' ')
debug_token = g_intern_static_string (debug);
else if (debug)
g_warning ("Unrecognized value '%s' for MIDORI_DEBUG.", debug);
@@ -1593,6 +1593,9 @@ midori_debug (const gchar* token)
debug_tokens, full_debug_tokens);
}
}
+ if (debug_token != g_intern_static_string ("NONE")
+ && !strstr (debug_tokens, token) && !strstr (full_debug_tokens, token))
+ g_warning ("Token '%s' passed to midori_debug is not a known token.", token);
return debug_token == g_intern_static_string (token);
}
More information about the Xfce4-commits
mailing list