[cairo] [PATCH 1/3] Make _cairo_error return the status passed to it

Jeff Muizelaar jeff at infidigm.net
Fri Sep 28 07:49:28 PDT 2007


This allows for more concise code:
    _cairo_error(CAIRO_STATUS_NO_MEMORY)
    return CAIRO_STATUS_NO_MEMORY
can become:
    return _cairo_error(CAIRO_STATUS_NO_MEMORY);
---

 src/cairo.c    |    3 ++-
 src/cairoint.h |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)


diff --git a/src/cairo.c b/src/cairo.c
index 8652b28..c235a3d 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -84,11 +84,12 @@ static const cairo_t _cairo_nil = {
  * breakpoint in _cairo_error() to generate a stack trace for when the
  * user causes cairo to detect an error.
  **/
-void
+cairo_status_t
 _cairo_error (cairo_status_t status)
 {
     assert (status > CAIRO_STATUS_SUCCESS &&
 	    status <= CAIRO_STATUS_LAST_STATUS);
+    return status;
 }
 
 /**
diff --git a/src/cairoint.h b/src/cairoint.h
index be7079c..cb764d2 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -2299,7 +2299,7 @@ _cairo_utf8_to_utf16 (const unsigned char *str,
 		      uint16_t		 **result,
 		      int		  *items_written);
 
-cairo_private void
+cairo_private cairo_status_t
 _cairo_error (cairo_status_t status);
 
 /* Avoid unnecessary PLT entries.  */



More information about the cairo mailing list