Skip to content

Commit

Permalink
Add a macro to determine whether a status is a fatal error.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Chris Wilson committed Sep 26, 2008
1 parent ba18d57 commit 06f0cc8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/cairo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 3 additions & 0 deletions src/cairoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 06f0cc8

Please sign in to comment.