diff options
| author | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2010-02-01 19:50:04 +0000 |
|---|---|---|
| committer | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2010-02-01 19:50:04 +0000 |
| commit | 2a7b411ea11f96c12d862b0d7d21cdb1c05fe454 (patch) | |
| tree | aa58b33c2325e42e35d880eaa2285c2276ab4b7d | |
| parent | a45b383cd0f6d406f06c6b0b0ce99bdb75e27f99 (diff) | |
Core: in utils.h, add macros to replace verbose g_return_val_if_fail
| -rw-r--r-- | lasso/utils.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lasso/utils.h b/lasso/utils.h index efc15e6c..f8ec8c37 100644 --- a/lasso/utils.h +++ b/lasso/utils.h @@ -579,4 +579,16 @@ int lasso_gobject_is_of_type(GObject *a, GType b); (type*) g_list_find_custom(list, \ (gconstpointer)gobjecttype, (GCompareFunc)lasso_gobject_is_of_type); +/* + * Simplify simple accessors argument checking. + * + */ +#define lasso_return_val_if_fail(assertion, value) \ + if (!(assertion)) return (value); + +#define lasso_return_null_if_fail(assertion) \ + lasso_return_val_if_fail(assertion, NULL) + +#define lasso_return_if_fail(assertion) \ + if (!(assertion)) return; #endif /* __LASSO_UTILS_H__ */ |
