[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[augeas-devel] augeas: master - * src/errcode.h (ensure0): convenience version of ensure



Gitweb:        http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=cd0ea32a900dc19f1acd9158e9f9f008e5691b8b
Commit:        cd0ea32a900dc19f1acd9158e9f9f008e5691b8b
Parent:        64c27e674388c7dc482e90ac9b7573fe95170049
Author:        David Lutterkort <lutter redhat com>
AuthorDate:    Thu Jan 21 17:33:06 2010 -0800
Committer:     David Lutterkort <lutter redhat com>
CommitterDate: Mon Jan 25 17:22:30 2010 -0800

* src/errcode.h (ensure0): convenience version of ensure

---
 src/errcode.h |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/errcode.h b/src/errcode.h
index a61fb51..2eb3bde 100644
--- a/src/errcode.h
+++ b/src/errcode.h
@@ -77,13 +77,19 @@ void bug_on(struct error *err, const char *srcfile, int srclineno,
  * instead of aborting
  */
 #ifdef NDEBUG
-# define ensure(cond, obj) ((void) (0))
+# define ensure(cond, obj) if (0) goto error
+# define ensure0(cond, obj) if (0) goto error
 #else
 # define ensure(cond, obj)                                           \
     if (!(cond)) {                                                   \
         bug_on((obj)->error, __FILE__, __LINE__, NULL);              \
         goto error;                                                  \
     }
+# define ensure0(cond, obj)                                          \
+    if (!(cond)) {                                                   \
+        bug_on((obj)->error, __FILE__, __LINE__, NULL);              \
+        return NULL;                                                 \
+    }
 #endif
 
 #define BUG_ON(cond, obj, fmt ...)                                  \



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]