[cairo] [PATCH 03/41] core: _canonical_box() allow NULL box ptr

Enrico Weigelt, metux IT consult enrico.weigelt at gr13.net
Thu Dec 10 14:16:39 PST 2015

This function is used by several others which can test pathes
for certain properties (eg. _cairo_path_fixed_is_box()),
but expect a pointer to cairo_box_t, which is passed to
_canonical_box() for filling.

In some cases we dont need that at all and dont wanna have the
burden of maintaining that return structure, so allow that to
be skiped by just passing a null pointer.

Signed-off-by: Enrico Weigelt, metux IT consult <enrico.weigelt at gr13.net>
 src/cairo-path-fixed.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/cairo-path-fixed.c b/src/cairo-path-fixed.c
index ac44bb7..36c332f 100644
--- a/src/cairo-path-fixed.c
+++ b/src/cairo-path-fixed.c
@@ -1203,6 +1203,9 @@ _canonical_box (cairo_box_t *box,
 		const cairo_point_t *p1,
 		const cairo_point_t *p2)
+    if (box == NULL)
+	return;
     if (p1->x <= p2->x) {
 	box->p1.x = p1->x;
 	box->p2.x = p2->x;

More information about the cairo mailing list