[cairo-commit] 2 commits - src/cairo-bentley-ottmann-rectangular.c src/cairo-png.c util/cairo-script

Adrian Johnson ajohnson at kemper.freedesktop.org
Sat Oct 21 02:39:05 UTC 2017


 src/cairo-bentley-ottmann-rectangular.c      |    8 +++++++-
 src/cairo-png.c                              |   17 +++++++++++------
 util/cairo-script/cairo-script-interpreter.c |   11 +++++++++++
 util/cairo-script/cairo-script-private.h     |   11 ++---------
 4 files changed, 31 insertions(+), 16 deletions(-)

New commits:
commit 9ffbf63d3715f81ec92cdba93b60a04a11be130f
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sat Oct 21 13:05:26 2017 +1030

    fix warning: inlining failed in call to '_csi_stack_push'

diff --git a/util/cairo-script/cairo-script-interpreter.c b/util/cairo-script/cairo-script-interpreter.c
index dfce8a1a..a578ec43 100644
--- a/util/cairo-script/cairo-script-interpreter.c
+++ b/util/cairo-script/cairo-script-interpreter.c
@@ -179,6 +179,17 @@ _csi_slab_free (csi_t *ctx, void *ptr, int size)
 #endif
 }
 
+csi_status_t
+_csi_stack_push (csi_t *ctx, csi_stack_t *stack,
+		 const csi_object_t *obj)
+{
+    if (_csi_unlikely (stack->len == stack->size))
+	return _csi_stack_push_internal (ctx, stack, obj);
+
+    stack->objects[stack->len++] = *obj;
+    return CSI_STATUS_SUCCESS;
+}
+
 static void
 _csi_perm_fini (csi_t *ctx)
 {
diff --git a/util/cairo-script/cairo-script-private.h b/util/cairo-script/cairo-script-private.h
index da846dcb..ac633c95 100644
--- a/util/cairo-script/cairo-script-private.h
+++ b/util/cairo-script/cairo-script-private.h
@@ -916,16 +916,9 @@ csi_number_get_value (const csi_object_t *obj)
     }
 }
 
-static inline csi_status_t
+csi_status_t
 _csi_stack_push (csi_t *ctx, csi_stack_t *stack,
-		 const csi_object_t *obj)
-{
-    if (_csi_unlikely (stack->len == stack->size))
-	return _csi_stack_push_internal (ctx, stack, obj);
-
-    stack->objects[stack->len++] = *obj;
-    return CSI_STATUS_SUCCESS;
-}
+		 const csi_object_t *obj);
 
 static inline csi_boolean_t
 _csi_check_ostack (csi_t *ctx, csi_integer_t count)
commit b092b63119cbfe3cb4bc786eee81630998996acf
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sat Oct 21 13:02:42 2017 +1030

    fix warning: variable X might be clobbered by 'longjmp'
    
    Move calls to setjmp into separate function to avoid clobbering
    local variables.

diff --git a/src/cairo-bentley-ottmann-rectangular.c b/src/cairo-bentley-ottmann-rectangular.c
index 29f902c1..15688c74 100644
--- a/src/cairo-bentley-ottmann-rectangular.c
+++ b/src/cairo-bentley-ottmann-rectangular.c
@@ -593,6 +593,12 @@ sweep_line_insert (sweep_line_t	*sweep, rectangle_t *rectangle)
     pqueue_push (sweep, rectangle);
 }
 
+static int
+sweep_line_setjmp (sweep_line_t *sweep_line)
+{
+    return setjmp (sweep_line->unwind);
+}
+
 static cairo_status_t
 _cairo_bentley_ottmann_tessellate_rectangular (rectangle_t	**rectangles,
 					       int			  num_rectangles,
@@ -609,7 +615,7 @@ _cairo_bentley_ottmann_tessellate_rectangular (rectangle_t	**rectangles,
 		     rectangles, num_rectangles,
 		     fill_rule,
 		     do_traps, container);
-    if ((status = setjmp (sweep_line.unwind)))
+    if ((status = sweep_line_setjmp (&sweep_line)))
 	return status;
 
     rectangle = rectangle_pop_start (&sweep_line);
diff --git a/src/cairo-png.c b/src/cairo-png.c
index 562b7439..eab2537b 100644
--- a/src/cairo-png.c
+++ b/src/cairo-png.c
@@ -158,6 +158,14 @@ png_simple_warning_callback (png_structp png,
      */
 }
 
+static int
+png_setjmp (png_struct *png)
+{
+#ifdef PNG_SETJMP_SUPPORTED
+    return setjmp (png_jmpbuf (png));
+#endif
+    return 0;
+}
 
 /* Starting with libpng-1.2.30, we must explicitly specify an output_flush_fn.
  * Otherwise, we will segfault if we are writing to a stream. */
@@ -229,10 +237,8 @@ write_png (cairo_surface_t	*surface,
 	goto BAIL4;
     }
 
-#ifdef PNG_SETJMP_SUPPORTED
-    if (setjmp (png_jmpbuf (png)))
+    if (png_setjmp (png))
 	goto BAIL4;
-#endif
 
     png_set_write_fn (png, closure, write_func, png_simple_output_flush_fn);
 
@@ -573,12 +579,11 @@ read_png (struct png_read_closure_t *png_closure)
     png_set_read_fn (png, png_closure, stream_read_func);
 
     status = CAIRO_STATUS_SUCCESS;
-#ifdef PNG_SETJMP_SUPPORTED
-    if (setjmp (png_jmpbuf (png))) {
+
+    if (png_setjmp (png)) {
 	surface = _cairo_surface_create_in_error (status);
 	goto BAIL;
     }
-#endif
 
     png_read_info (png, info);
 


More information about the cairo-commit mailing list