fixup last commit

This commit is contained in:
Markus Teich 2016-07-13 12:22:23 +02:00
parent 1636ff8c49
commit 9fcc42d6ab

30
util.h
View File

@ -33,35 +33,41 @@ void weprintf (const char *fmt, ...);
#ifdef NDEBUG #ifdef NDEBUG
#define brandt_assert(expr) ((expr) ? (void)(0) : \ #define brandt_assert(expr) do { \
eprintf("Assertion failed in file %s line %d function %s: %s", \ (expr) ? (void)(0) : eprintf ( \
"Assertion failed in file %s line %d function %s: %s", \
__FILE__, \ __FILE__, \
__LINE__, \ __LINE__, \
__PRETTY_FUNCTION__, \ __PRETTY_FUNCTION__, \
(#expr))) (# expr)); \
} while (0)
#define brandt_assert_perror(errnum) (!(errnum) ? (void)(0) : \ #define brandt_assert_perror(errnum) do { \
eprintf("Assertion failed in file %s line %d function %s:", \ !(errnum) ? (void)(0) : eprintf ( \
"Assertion failed in file %s line %d function %s:", \
__FILE__, \ __FILE__, \
__LINE__, \ __LINE__, \
__PRETTY_FUNCTION__)) __PRETTY_FUNCTION__); \
} while (0)
#define brandt_assert_gpgerr(errnum) (!(errnum) ? (void)(0) : \ #define brandt_assert_gpgerr(errnum) do { \
eprintf("Assertion failed in file %s line %d function %s: %s", \ !(errnum) ? (void)(0) : eprintf ( \
"Assertion failed in file %s line %d function %s: %s", \
__FILE__, \ __FILE__, \
__LINE__, \ __LINE__, \
__PRETTY_FUNCTION__, \ __PRETTY_FUNCTION__, \
gcry_strerror((errnum)))) gcry_strerror ((errnum))); \
} while (0)
#define DP(point) ((void)(gcry_log_debugpnt (# point, point, ec_ctx))) #define DP(point) ((void)(gcry_log_debugpnt (# point, point, ec_ctx)))
#define DM(mpi) ((void)(gcry_log_debugmpi (# mpi, mpi, 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(expr) ((void)(expr))
#define brandt_assert_perror(errnum) ((void)(errnum)) #define brandt_assert_perror(errnum) ((void)(errnum))
#define brandt_assert_gpgerr(errnum) ((void)(errnum)) #define brandt_assert_gpgerr(errnum) ((void)(errnum))
#endif #endif /* ifdef NDEBUG */
#endif #endif /* ifndef _BRANDT_UTIL_H */