[Pkg-gnupg-commit] [gnupg2] 64/205: common: Add log_assert.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed May 11 08:38:17 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch experimental
in repository gnupg2.

commit f57a91afb69c58f9d8d9632801650f28c7dc1e0d
Author: Neal H. Walfield <neal at g10code.com>
Date:   Tue Feb 23 21:14:21 2016 +0100

    common: Add log_assert.
    
    * common/logging.h (log_assert): New macro.
    
    --
    Signed-off-by: Neal H. Walfield <neal at g10code.com>
---
 common/logging.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/common/logging.h b/common/logging.h
index c4ae5d0..d0b1597 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);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list