[evolution-data-server/gnome-3-10] CamelStreamFilter: Fix broken debugging statements.



commit bf7a75f1efab2850382ca72d3727dd045ce3dbc8
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Dec 6 11:52:11 2013 -0500

    CamelStreamFilter: Fix broken debugging statements.
    
    Camel likes to use this debugging idiom:
    
      #define d(x)
    
    and then wraps debugging statements like so:
    
      d (printf (...));
    
    One is supposed to enable debugging by changing the macro to:
    
      #define d(x) x
    
    This idiom makes debugging statements hard to grep for, but moreover
    they don't get compiled regularly and so they tend to bit rot.
    
    As was the case in CamelStreamFilter, where the debugging statements
    didn't build because they were calling CamelStream functions as they
    existed YEARS ago.
    
    (cherry picked from commit 5088aefaa2f1e3853faeeb680c6cbb60ba4e6c4a)

 camel/camel-stream-filter.c |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/camel/camel-stream-filter.c b/camel/camel-stream-filter.c
index cdd5f53..2fa94e4 100644
--- a/camel/camel-stream-filter.c
+++ b/camel/camel-stream-filter.c
@@ -139,7 +139,9 @@ stream_filter_read (CamelStream *stream,
                        priv->filtered = priv->buffer;
                        priv->filteredlen = size;
 
-                       d (printf ("\n\nOriginal content (%s): '", ((CamelObject *) 
priv->source)->class->name));
+                       d (printf (
+                               "\n\nOriginal content (%s): '",
+                               G_OBJECT_TYPE_NAME (priv->source)));
                        d (fwrite (priv->filtered, sizeof (gchar), priv->filteredlen, stdout));
                        d (printf ("'\n"));
 
@@ -149,7 +151,9 @@ stream_filter_read (CamelStream *stream,
                                        &priv->filtered, &priv->filteredlen, &presize);
                                g_check (priv->realbuffer);
 
-                               d (printf ("Filtered content (%s): '", ((CamelObject *) 
f->filter)->class->name));
+                               d (printf (
+                                       "Filtered content (%s): '",
+                                       G_OBJECT_TYPE_NAME (f->filter)));
                                d (fwrite (priv->filtered, sizeof (gchar), priv->filteredlen, stdout));
                                d (printf ("'\n"));
 
@@ -187,7 +191,9 @@ stream_filter_write (CamelStream *stream,
 
        priv->last_was_read = FALSE;
 
-       d (printf ("\n\nWriting: Original content (%s): '", ((CamelObject *) priv->source)->class->name));
+       d (printf (
+               "\n\nWriting: Original content (%s): '",
+               G_OBJECT_TYPE_NAME (priv->source)));
        d (fwrite (buf, sizeof (gchar), n, stdout));
        d (printf ("'\n"));
 
@@ -208,7 +214,9 @@ stream_filter_write (CamelStream *stream,
 
                        g_check (priv->realbuffer);
 
-                       d (printf ("Filtered content (%s): '", ((CamelObject *) f->filter)->class->name));
+                       d (printf (
+                               "Filtered content (%s): '",
+                               G_OBJECT_TYPE_NAME (f->filter)));
                        d (fwrite (buffer, sizeof (gchar), len, stdout));
                        d (printf ("'\n"));
 
@@ -245,14 +253,18 @@ stream_filter_flush (CamelStream *stream,
        presize = 0;
        f = priv->filters;
 
-       d (printf ("\n\nFlushing: Original content (%s): '", ((CamelObject *) priv->source)->class->name));
+       d (printf (
+               "\n\nFlushing: Original content (%s): '",
+               G_OBJECT_TYPE_NAME (priv->source)));
        d (fwrite (buffer, sizeof (gchar), len, stdout));
        d (printf ("'\n"));
 
        while (f) {
                camel_mime_filter_complete (f->filter, buffer, len, presize, &buffer, &len, &presize);
 
-               d (printf ("Filtered content (%s): '", ((CamelObject *) f->filter)->class->name));
+               d (printf (
+                       "Filtered content (%s): '",
+                       G_OBJECT_TYPE_NAME (f->filter)));
                d (fwrite (buffer, sizeof (gchar), len, stdout));
                d (printf ("'\n"));
 


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