[Xfce4-commits] <terminal:master> Use NDEBUG so debug output is printed on both --enable-debug={full, yes}.

Nick Schermer noreply at xfce.org
Wed Oct 7 10:14:02 CEST 2009


Updating branch refs/heads/master
         to ff95f65a121a59b012312aad3e825e135bb96d52 (commit)
       from aa9addd2fc493d0a8b106dbaf9b4b47d65d46989 (commit)

commit ff95f65a121a59b012312aad3e825e135bb96d52
Author: Nick Schermer <nick at xfce.org>
Date:   Wed Oct 7 10:11:18 2009 +0200

    Use NDEBUG so debug output is printed on both --enable-debug={full,yes}.
    
    Also use g_debug where possible, so it's more clear it is nothing critical.

 terminal/main.c                  |    6 +++---
 terminal/terminal-image-loader.c |   27 +++++++--------------------
 terminal/terminal-preferences.c  |    6 +++---
 terminal/terminal-screen.c       |    2 +-
 4 files changed, 14 insertions(+), 27 deletions(-)

diff --git a/terminal/main.c b/terminal/main.c
index 2d52e39..066624c 100644
--- a/terminal/main.c
+++ b/terminal/main.c
@@ -153,7 +153,7 @@ main (int argc, char **argv)
   /* required because we don't call gtk_init() prior to usage() */
   gtk_set_locale ();
 
-#ifdef G_ENABLE_DEBUG
+#ifndef NDEBUG
   /* Do NOT remove this line for now, If something doesn't work,
    * fix your code instead!
    */
@@ -229,13 +229,13 @@ main (int argc, char **argv)
             {
               /* don't try to establish another service here */
               options->disable_server = TRUE;
-#ifdef G_ENABLE_DEBUG
+#ifndef NDEBUG
               g_debug ("User mismatch when invoking remote terminal: %s", error->message);
             }
           else
             {
               g_debug ("No running instance found: %s", error->message);
-#endif /* !DEBUG */
+#endif
             }
 
           g_error_free (error);
diff --git a/terminal/terminal-image-loader.c b/terminal/terminal-image-loader.c
index 4d1d228..10748c8 100644
--- a/terminal/terminal-image-loader.c
+++ b/terminal/terminal-image-loader.c
@@ -183,10 +183,9 @@ terminal_image_loader_pixbuf_destroyed (gpointer data,
         return;
       }
 
-#ifdef DEBUG
+#ifndef NDEBUG
   g_warning ("Pixbuf %p was freed from loader cache %p, "
-             "this should not happend",
-             pixbuf, loader);
+             "this should not happend", pixbuf, loader);
   terminal_assert_not_reached ();
 #endif
 }
@@ -466,23 +465,11 @@ terminal_image_loader_load (TerminalImageLoader *loader,
   if (G_UNLIKELY (loader->pixbuf == NULL || width <= 1 || height <= 1))
     return NULL;
 
-#ifdef DEBUG
-  g_print ("Image Loader memory status:\n"
-           "~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n"
-           " Images in valid cache:\n");
-  for (lp = loader->cache; lp != NULL; lp = lp->next)
-    {
-      g_print ("  %p with refcount of %d\n", lp->data,
-               G_OBJECT (lp->data)->ref_count);
-    }
-
-  g_print ("\n Images in invalid cache:\n");
-  for (lp = loader->cache_invalid; lp != NULL; lp = lp->next)
-    {
-      g_print ("  %p with refcount of %d\n", lp->data,
-               G_OBJECT (lp->data)->ref_count);
-    }
-  g_print ("\n");
+#ifndef NDEBUG
+  g_debug ("Image Loader Memory Status: %d images in valid "
+           "cache, %d in invalid cache",
+           g_slist_length (loader->cache),
+           g_slist_length (loader->cache_invalid));
 #endif
 
   /* check for a cached version */
diff --git a/terminal/terminal-preferences.c b/terminal/terminal-preferences.c
index 2755a7b..9c50922 100644
--- a/terminal/terminal-preferences.c
+++ b/terminal/terminal-preferences.c
@@ -1437,7 +1437,7 @@ terminal_preferences_check_blurb (GParamSpec *spec)
 
   /* check if the generated option name is equal to the blurb */
   if (!exo_str_is_equal (option, g_param_spec_get_blurb (spec)))
-    g_critical ("Blurb does not match option name %s", name);
+    g_error ("The blurb of property \"%s\" does not match option name", name);
 
   /* cleanup */
   g_free (option);
@@ -1763,7 +1763,7 @@ terminal_preferences_monitor_connect (TerminalPreferences *preferences,
         {
           /* connect signal */
 #ifndef NDEBUG
-          g_message ("Monitoring \"%s\" for changes.", filename);
+          g_debug ("Monitoring \"%s\" for changes.", filename);
 #endif
           g_signal_connect (G_OBJECT (preferences->monitor), "changed",
                             G_CALLBACK (terminal_preferences_monitor_changed),
@@ -1772,7 +1772,7 @@ terminal_preferences_monitor_connect (TerminalPreferences *preferences,
       else
         {
           g_critical ("Failed to setup monitoring for file \"%s\": %s",
-                       filename, error->message);
+                      filename, error->message);
           g_error_free (error);
         }
     }
diff --git a/terminal/terminal-screen.c b/terminal/terminal-screen.c
index 446b44f..6b0f016 100644
--- a/terminal/terminal-screen.c
+++ b/terminal/terminal-screen.c
@@ -1121,7 +1121,7 @@ terminal_screen_launch_child (TerminalScreen *screen)
 
   terminal_return_if_fail (TERMINAL_IS_SCREEN (screen));
 
-#ifdef G_ENABLE_DEBUG
+#ifndef NDEBUG
   if (!GTK_WIDGET_REALIZED (screen))
     g_error ("Tried to launch command in a TerminalScreen that is not realized");
 #endif



More information about the Xfce4-commits mailing list