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);
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);
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);
}