glib r7710 - in trunk: . glib



Author: behdad
Date: Sat Nov 29 01:40:38 2008
New Revision: 7710
URL: http://svn.gnome.org/viewvc/glib?rev=7710&view=rev

Log:
2008-11-28  Behdad Esfahbod  <behdad gnome org>

        Bug 562639 â g_parse_debug_flags() parsing "help"

        * glib/gutils.c (g_parse_debug_string): Print available keys if
        string is "help".



Modified:
   trunk/ChangeLog
   trunk/glib/gutils.c

Modified: trunk/glib/gutils.c
==============================================================================
--- trunk/glib/gutils.c	(original)
+++ trunk/glib/gutils.c	Sat Nov 29 01:40:38 2008
@@ -615,7 +615,7 @@
 /**
  * g_parse_debug_string:
  * @string: a list of debug options separated by colons, spaces, or
- * commas; or the string "all" to set all flags, or %NULL.
+ * commas, or %NULL.
  * @keys: pointer to an array of #GDebugKey which associate 
  *     strings with bit flags.
  * @nkeys: the number of #GDebugKey<!-- -->s in the array.
@@ -625,6 +625,10 @@
  * within GDK and GTK+ to parse the debug options passed on the
  * command line or through environment variables.
  *
+ * If @string is equal to "all", all flags are set.  If @string
+ * is equal to "help", all the available keys in @keys are printed
+ * out to standard error.
+ *
  * Returns: the combined set of bit flags.
  */
 guint	     
@@ -648,6 +652,14 @@
       for (i=0; i<nkeys; i++)
 	result |= keys[i].value;
     }
+  else if (!g_ascii_strcasecmp (string, "help"))
+    {
+      /* using stdio directly for the reason stated above */
+      fprintf (stderr, "Supported debug values: ");
+      for (i=0; i<nkeys; i++)
+	fprintf (stderr, " %s", keys[i].key);
+      fprintf (stderr, "\n");
+    }
   else
     {
       const gchar *p = string;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]