pixman: Branch 'master' - 3 commits

Benjamin Otte company at kemper.freedesktop.org
Tue Jul 21 23:51:24 PDT 2009


 pixman/pixman-region.c |   25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

New commits:
commit 1435c8aa3db3b6bde26216e260cc94baba225664
Author: Benjamin Otte <otte at gnome.org>
Date:   Tue Jul 21 15:00:52 2009 +0200

    Log errors for invalid rectangles passed to region code

diff --git a/pixman/pixman-region.c b/pixman/pixman-region.c
index 6baf716..708ac7c 100644
--- a/pixman/pixman-region.c
+++ b/pixman/pixman-region.c
@@ -385,6 +385,7 @@ PREFIX (_init_rect) (region_type_t *	region,
 
     if (!GOOD_RECT (&region->extents))
     {
+        log_region_error (FUNC, "Invalid rectangle passed");
         PREFIX (_init) (region);
         return;
     }
@@ -397,6 +398,7 @@ PREFIX (_init_with_extents) (region_type_t *region, box_type_t *extents)
 {
     if (!GOOD_RECT (extents))
     {
+        log_region_error (FUNC, "Invalid rectangle passed");
         PREFIX (_init) (region);
         return;
     }
@@ -1348,7 +1350,10 @@ PREFIX (_union_rect) (region_type_t *dest,
     region.extents.y2 = y + height;
 
     if (!GOOD_RECT (&region.extents))
+    {
+        log_region_error (FUNC, "Invalid rectangle passed");
 	return PREFIX (_copy) (dest, source);
+    }
     
     region.data = NULL;
 
commit 1796e6bf17a5d20039e098c4e352cd2765ed444e
Author: Benjamin Otte <otte at gnome.org>
Date:   Tue Jul 21 14:57:59 2009 +0200

    Simplify code that logs errors

diff --git a/pixman/pixman-region.c b/pixman/pixman-region.c
index 1c5ef8d..6baf716 100644
--- a/pixman/pixman-region.c
+++ b/pixman/pixman-region.c
@@ -67,11 +67,7 @@
 
 #define PIXMAN_REGION_LOG_FAILURES
 
-#if defined PIXMAN_REGION_DEBUG
-
-#    define GOOD(reg) assert (PREFIX (_selfcheck) (reg))
-
-#elif defined PIXMAN_REGION_LOG_FAILURES
+#if defined PIXMAN_REGION_LOG_FAILURES || defined PIXMAN_REGION_DEBUG
 
 static void
 log_region_error (const char *function, const char *message)
@@ -86,6 +82,10 @@ log_region_error (const char *function, const char *message)
 		 "Set a breakpoint on 'log_region_error' to debug\n\n",
                  function, message);
 
+#if defined PIXMAN_REGION_DEBUG
+        abort ();
+#endif
+
 	n_messages++;
     }
 }
@@ -99,6 +99,7 @@ log_region_error (const char *function, const char *message)
 
 #else
 
+#define log_region_error(function, name)
 #define GOOD(reg)
 
 #endif
commit 85d56f3f7cb9c90c5af52b28fb6f7c1b14f09f07
Author: Benjamin Otte <otte at gnome.org>
Date:   Tue Jul 21 14:50:30 2009 +0200

    Make the text when reporting a broken region more useful

diff --git a/pixman/pixman-region.c b/pixman/pixman-region.c
index 387dbba..1c5ef8d 100644
--- a/pixman/pixman-region.c
+++ b/pixman/pixman-region.c
@@ -74,7 +74,7 @@
 #elif defined PIXMAN_REGION_LOG_FAILURES
 
 static void
-log_region_error (void)
+log_region_error (const char *function, const char *message)
 {
     static int n_messages = 0;
 
@@ -82,8 +82,9 @@ log_region_error (void)
     {
 	fprintf (stderr,
 		 "*** BUG ***\n"
-		 "Malformed region detected\n"
-		 "Set a breakpoint on 'log_region_error' to debug\n\n");
+		 "%s: %s\n"
+		 "Set a breakpoint on 'log_region_error' to debug\n\n",
+                 function, message);
 
 	n_messages++;
     }
@@ -93,7 +94,7 @@ log_region_error (void)
     do									\
     {									\
 	if (!PREFIX (_selfcheck (reg)))					\
-	    log_region_error ();					\
+	    log_region_error (FUNC, "Malformed region " # reg);         \
     } while (0)
 
 #else


More information about the xorg-commit mailing list