/src/cairo/src/cairo-error.c
Line | Count | Source |
1 | | /* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 8; -*- */ |
2 | | /* cairo - a vector graphics library with display and print output |
3 | | * |
4 | | * Copyright © 2002 University of Southern California |
5 | | * Copyright © 2005 Red Hat, Inc. |
6 | | * |
7 | | * This library is free software; you can redistribute it and/or |
8 | | * modify it either under the terms of the GNU Lesser General Public |
9 | | * License version 2.1 as published by the Free Software Foundation |
10 | | * (the "LGPL") or, at your option, under the terms of the Mozilla |
11 | | * Public License Version 1.1 (the "MPL"). If you do not alter this |
12 | | * notice, a recipient may use your version of this file under either |
13 | | * the MPL or the LGPL. |
14 | | * |
15 | | * You should have received a copy of the LGPL along with this library |
16 | | * in the file COPYING-LGPL-2.1; if not, write to the Free Software |
17 | | * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA |
18 | | * You should have received a copy of the MPL along with this library |
19 | | * in the file COPYING-MPL-1.1 |
20 | | * |
21 | | * The contents of this file are subject to the Mozilla Public License |
22 | | * Version 1.1 (the "License"); you may not use this file except in |
23 | | * compliance with the License. You may obtain a copy of the License at |
24 | | * http://www.mozilla.org/MPL/ |
25 | | * |
26 | | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY |
27 | | * OF ANY KIND, either express or implied. See the LGPL or the MPL for |
28 | | * the specific language governing rights and limitations. |
29 | | * |
30 | | * The Original Code is the cairo graphics library. |
31 | | * |
32 | | * The Initial Developer of the Original Code is University of Southern |
33 | | * California. |
34 | | * |
35 | | * Contributor(s): |
36 | | * Carl D. Worth <cworth@cworth.org> |
37 | | */ |
38 | | |
39 | | #include "cairoint.h" |
40 | | #include "cairo-private.h" |
41 | | |
42 | | #include "cairo-compiler-private.h" |
43 | | #include "cairo-error-private.h" |
44 | | |
45 | | #include <assert.h> |
46 | | |
47 | | /*< private > |
48 | | * _cairo_error: |
49 | | * @status: a status value indicating an error, (eg. not |
50 | | * %CAIRO_STATUS_SUCCESS) |
51 | | * |
52 | | * Checks that status is an error status, but does nothing else. |
53 | | * |
54 | | * All assignments of an error status to any user-visible object |
55 | | * within the cairo application should result in a call to |
56 | | * _cairo_error(). |
57 | | * |
58 | | * The purpose of this function is to allow the user to set a |
59 | | * breakpoint in _cairo_error() to generate a stack trace for when the |
60 | | * user causes cairo to detect an error. |
61 | | * |
62 | | * Return value: the error status. |
63 | | **/ |
64 | | cairo_status_t |
65 | | _cairo_error (cairo_status_t status) |
66 | 189 | { |
67 | 189 | CAIRO_ENSURE_UNIQUE; |
68 | 189 | assert (_cairo_status_is_error (status)); |
69 | | |
70 | 189 | return status; |
71 | 189 | } |
72 | | |
73 | | COMPILE_TIME_ASSERT ((int)CAIRO_INT_STATUS_LAST_STATUS == (int)CAIRO_STATUS_LAST_STATUS); |