summaryrefslogtreecommitdiff
path: root/pjlib/include/pj/assert.h
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2005-12-30 23:50:15 +0000
committerBenny Prijono <bennylp@teluu.com>2005-12-30 23:50:15 +0000
commit944562492d0c16b9e44ec4e1cc97657846d82cd0 (patch)
tree6e6c2e65e95e479384faeeaab4f525fa91cc7f27 /pjlib/include/pj/assert.h
parent9b86a2145e18cb843e69167b10f3c7414c11c634 (diff)
Basic module, transport, and sending messages
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@106 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/include/pj/assert.h')
-rw-r--r--pjlib/include/pj/assert.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/pjlib/include/pj/assert.h b/pjlib/include/pj/assert.h
index 5a842477..6814e4cd 100644
--- a/pjlib/include/pj/assert.h
+++ b/pjlib/include/pj/assert.h
@@ -67,6 +67,26 @@
# define PJ_ASSERT_RETURN(expr,retval) pj_assert(expr)
#endif
+/**
+ * @hideinitializer
+ * If #PJ_ENABLE_EXTRA_CHECK is declared and non-zero, then
+ * #PJ_ASSERT_ON_FAIL macro will evaluate the expression in @a expr during
+ * run-time. If the expression yields false, assertion will be triggered
+ * and @a exec_on_fail will be executed.
+ *
+ * If #PJ_ENABLE_EXTRA_CHECK is not declared or is zero, then no run-time
+ * checking will be performed. The macro simply evaluates to pj_assert(expr).
+ */
+#if defined(PJ_ENABLE_EXTRA_CHECK) && PJ_ENABLE_EXTRA_CHECK != 0
+# define PJ_ASSERT_ON_FAIL(expr,exec_on_fail) \
+ do { \
+ pj_assert(expr); \
+ if (!(expr)) exec_on_fail; \
+ } while (0)
+#else
+# define PJ_ASSERT_ON_FAIL(expr,exec_on_fail) pj_assert(expr)
+#endif
+
/** @} */
#endif /* __PJ_ASSERT_H__ */