aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Teich <markus.teich@stusta.mhn.de>2016-07-13 12:22:23 +0200
committerMarkus Teich <markus.teich@stusta.mhn.de>2016-07-13 12:22:23 +0200
commit9fcc42d6ab3bc386c9b42861a69421f534a247f8 (patch)
treee4af183199bfd3a2ecedea06023229e3b5499759
parent1636ff8c4977e416499006c2571edf41f6e96c67 (diff)
fixup last commit
-rw-r--r--util.h50
1 files changed, 28 insertions, 22 deletions
diff --git a/util.h b/util.h
index 1e67197..faf893a 100644
--- a/util.h
+++ b/util.h
@@ -33,35 +33,41 @@ void weprintf (const char *fmt, ...);
#ifdef NDEBUG
-#define brandt_assert(expr) ((expr) ? (void)(0) : \
-eprintf("Assertion failed in file %s line %d function %s: %s", \
- __FILE__, \
- __LINE__, \
- __PRETTY_FUNCTION__, \
- (#expr)))
+#define brandt_assert(expr) do { \
+ (expr) ? (void)(0) : eprintf ( \
+ "Assertion failed in file %s line %d function %s: %s", \
+ __FILE__, \
+ __LINE__, \
+ __PRETTY_FUNCTION__, \
+ (# expr)); \
+} while (0)
-#define brandt_assert_perror(errnum) (!(errnum) ? (void)(0) : \
-eprintf("Assertion failed in file %s line %d function %s:", \
- __FILE__, \
- __LINE__, \
- __PRETTY_FUNCTION__))
+#define brandt_assert_perror(errnum) do { \
+ !(errnum) ? (void)(0) : eprintf ( \
+ "Assertion failed in file %s line %d function %s:", \
+ __FILE__, \
+ __LINE__, \
+ __PRETTY_FUNCTION__); \
+} while (0)
-#define brandt_assert_gpgerr(errnum) (!(errnum) ? (void)(0) : \
-eprintf("Assertion failed in file %s line %d function %s: %s", \
- __FILE__, \
- __LINE__, \
- __PRETTY_FUNCTION__, \
- gcry_strerror((errnum))))
+#define brandt_assert_gpgerr(errnum) do { \
+ !(errnum) ? (void)(0) : eprintf ( \
+ "Assertion failed in file %s line %d function %s: %s", \
+ __FILE__, \
+ __LINE__, \
+ __PRETTY_FUNCTION__, \
+ gcry_strerror ((errnum))); \
+} while (0)
-#define DP(point) ((void)(gcry_log_debugpnt (#point, point, ec_ctx)))
-#define DM(mpi) ((void)(gcry_log_debugmpi (#mpi, mpi, ec_ctx)))
+#define DP(point) ((void)(gcry_log_debugpnt (# point, point, ec_ctx)))
+#define DM(mpi) ((void)(gcry_log_debugmpi (# mpi, mpi, ec_ctx)))
-#else
+#else /* ifdef NDEBUG */
#define brandt_assert(expr) ((void)(expr))
#define brandt_assert_perror(errnum) ((void)(errnum))
#define brandt_assert_gpgerr(errnum) ((void)(errnum))
-#endif
+#endif /* ifdef NDEBUG */
-#endif
+#endif /* ifndef _BRANDT_UTIL_H */