[Pkg-gnupg-commit] [gnupg2] 28/116: common: Turn assertions into expressions.
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Tue Jan 24 04:40:50 UTC 2017
This is an automated email from the git hooks/post-receive script.
dkg pushed a commit to branch master
in repository gnupg2.
commit a1e0d4a1e75fc6e6c3392a4e1d1d27005b38d6cc
Author: Justus Winter <justus at g10code.com>
Date: Mon Jan 2 16:30:45 2017 +0100
common: Turn assertions into expressions.
* common/logging.h (log_assert): Turn this into an expression so it
can be used in expressions.
Signed-off-by: Justus Winter <justus at g10code.com>
---
common/logging.h | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/common/logging.h b/common/logging.h
index 64b999d..fc9e846 100644
--- a/common/logging.h
+++ b/common/logging.h
@@ -56,18 +56,18 @@ estream_t log_get_stream (void);
void _log_assert (const char *expr, const char *file, int line,
const char *func) GPGRT_ATTR_NORETURN;
# define BUG() bug_at( __FILE__ , __LINE__, __FUNCTION__)
-# define log_assert(expr) do { \
- if (!(expr)) \
- _log_assert (#expr, __FILE__, __LINE__, __FUNCTION__); \
- } while (0)
+# define log_assert(expr) \
+ ((expr) \
+ ? (void) 0 \
+ : _log_assert (#expr, __FILE__, __LINE__, __FUNCTION__))
#else /*!GPGRT_HAVE_MACRO_FUNCTION*/
void bug_at (const char *file, int line);
void _log_assert (const char *expr, const char *file, int line;
# define BUG() bug_at( __FILE__ , __LINE__ )
-# define log_assert(expr) do { \
- if (!(expr)) \
- _log_assert (#expr, __FILE__, __LINE__); \
- } while (0)
+# define log_assert(expr) \
+ ((expr) \
+ ? (void) 0 \
+ : _log_assert (#expr, __FILE__, __LINE__))
#endif /*!GPGRT_HAVE_MACRO_FUNCTION*/
/* Flag values for log_set_prefix. */
--
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