aboutsummaryrefslogtreecommitdiff
path: root/util.h
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 /util.h
parent1636ff8c4977e416499006c2571edf41f6e96c67 (diff)
downloadlibbrandt-9fcc42d6ab3bc386c9b42861a69421f534a247f8.tar.gz
libbrandt-9fcc42d6ab3bc386c9b42861a69421f534a247f8.zip
fixup last commit
Diffstat (limited to 'util.h')
-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, ...);
33 33
34#ifdef NDEBUG 34#ifdef NDEBUG
35 35
36#define brandt_assert(expr) ((expr) ? (void)(0) : \ 36#define brandt_assert(expr) do { \
37eprintf("Assertion failed in file %s line %d function %s: %s", \ 37 (expr) ? (void)(0) : eprintf ( \
38 __FILE__, \ 38 "Assertion failed in file %s line %d function %s: %s", \
39 __LINE__, \ 39 __FILE__, \
40 __PRETTY_FUNCTION__, \ 40 __LINE__, \
41 (#expr))) 41 __PRETTY_FUNCTION__, \
42 (# expr)); \
43} while (0)
42 44
43#define brandt_assert_perror(errnum) (!(errnum) ? (void)(0) : \ 45#define brandt_assert_perror(errnum) do { \
44eprintf("Assertion failed in file %s line %d function %s:", \ 46 !(errnum) ? (void)(0) : eprintf ( \
45 __FILE__, \ 47 "Assertion failed in file %s line %d function %s:", \
46 __LINE__, \ 48 __FILE__, \
47 __PRETTY_FUNCTION__)) 49 __LINE__, \
50 __PRETTY_FUNCTION__); \
51} while (0)
48 52
49#define brandt_assert_gpgerr(errnum) (!(errnum) ? (void)(0) : \ 53#define brandt_assert_gpgerr(errnum) do { \
50eprintf("Assertion failed in file %s line %d function %s: %s", \ 54 !(errnum) ? (void)(0) : eprintf ( \
51 __FILE__, \ 55 "Assertion failed in file %s line %d function %s: %s", \
52 __LINE__, \ 56 __FILE__, \
53 __PRETTY_FUNCTION__, \ 57 __LINE__, \
54 gcry_strerror((errnum)))) 58 __PRETTY_FUNCTION__, \
59 gcry_strerror ((errnum))); \
60} while (0)
55 61
56#define DP(point) ((void)(gcry_log_debugpnt (#point, point, ec_ctx))) 62#define DP(point) ((void)(gcry_log_debugpnt (# point, point, ec_ctx)))
57#define DM(mpi) ((void)(gcry_log_debugmpi (#mpi, mpi, ec_ctx))) 63#define DM(mpi) ((void)(gcry_log_debugmpi (# mpi, mpi, ec_ctx)))
58 64
59#else 65#else /* ifdef NDEBUG */
60 66
61#define brandt_assert(expr) ((void)(expr)) 67#define brandt_assert(expr) ((void)(expr))
62#define brandt_assert_perror(errnum) ((void)(errnum)) 68#define brandt_assert_perror(errnum) ((void)(errnum))
63#define brandt_assert_gpgerr(errnum) ((void)(errnum)) 69#define brandt_assert_gpgerr(errnum) ((void)(errnum))
64 70
65#endif 71#endif /* ifdef NDEBUG */
66 72
67#endif 73#endif /* ifndef _BRANDT_UTIL_H */