From 06f0cc81d227a571e011e83cc192050a34d6ea13 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 25 Sep 2008 10:29:27 +0100 Subject: [PATCH] Add a macro to determine whether a status is a fatal error. In a few places we need to check whether we have a fatal error or an internal return code, so provide a utility macro to centralise the check. --- src/cairo.c | 3 +-- src/cairoint.h | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cairo.c b/src/cairo.c index 9bb2b663d..b7a1b867b 100644 --- a/src/cairo.c +++ b/src/cairo.c @@ -84,8 +84,7 @@ static const cairo_t _cairo_nil = { cairo_status_t _cairo_error (cairo_status_t status) { - assert (status > CAIRO_STATUS_SUCCESS && - status <= CAIRO_STATUS_LAST_STATUS); + assert (_cairo_status_is_error (status)); return status; } diff --git a/src/cairoint.h b/src/cairoint.h index 1a3d16448..343b6f8df 100644 --- a/src/cairoint.h +++ b/src/cairoint.h @@ -2370,6 +2370,9 @@ _cairo_utf8_to_utf16 (const char *str, int *items_written); #endif +#define _cairo_status_is_error(status) \ + (status != CAIRO_STATUS_SUCCESS && status <= CAIRO_STATUS_LAST_STATUS) + cairo_private cairo_status_t _cairo_error (cairo_status_t status);