diff options
author | Neal H. Walfield <neal@g10code.com> | 2016-02-23 21:14:21 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@g10code.com> | 2016-02-23 21:14:21 +0100 |
commit | f57a91afb69c58f9d8d9632801650f28c7dc1e0d (patch) | |
tree | 8684703499b692d81a20bf0d39fe563c29be5688 /common/logging.h | |
parent | gpg: Use higher-level functions. (diff) | |
download | gnupg2-f57a91afb69c58f9d8d9632801650f28c7dc1e0d.tar.xz gnupg2-f57a91afb69c58f9d8d9632801650f28c7dc1e0d.zip |
common: Add log_assert.
* common/logging.h (log_assert): New macro.
--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
Diffstat (limited to 'common/logging.h')
-rw-r--r-- | common/logging.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/common/logging.h b/common/logging.h index c4ae5d0ee..d0b159700 100644 --- a/common/logging.h +++ b/common/logging.h @@ -81,6 +81,10 @@ void log_logv (int level, const char *fmt, va_list arg_ptr); void log_string (int level, const char *string); +#define log_assert(expr) \ + do \ + if (! (expr)) log_bug ("Assertion " #expr " failed.\n"); \ + while (0) void log_bug (const char *fmt, ...) GPGRT_ATTR_NR_PRINTF(1,2); void log_fatal (const char *fmt, ...) GPGRT_ATTR_NR_PRINTF(1,2); void log_error (const char *fmt, ...) GPGRT_ATTR_PRINTF(1,2); |