added zap_assert_return macro and replaced old use of zap_assert

git-svn-id: http://svn.openzap.org/svn/openzap/branches/sangoma_boost@911 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Moises Silva
2009-11-27 18:57:35 +00:00
parent 2f09453095
commit ecf3294a88
5 changed files with 43 additions and 32 deletions

View File

@@ -263,7 +263,7 @@
#define zap_set_state_locked(obj, s) if ( obj->state == s ) { \
zap_log(ZAP_LOG_WARNING, "Why bother changing state on %d:%d from %s to %s\n", obj->span_id, obj->chan_id, zap_channel_state2str(obj->state), zap_channel_state2str(s)); \
} else if (zap_test_flag(obj, ZAP_CHANNEL_READY)) { \
int st = obj->state; \
zap_channel_state_t st = obj->state; \
zap_channel_set_state(obj, s, 1); \
if (obj->state == s) zap_log(ZAP_LOG_DEBUG, "Changing state on %d:%d from %s to %s\n", obj->span_id, obj->chan_id, zap_channel_state2str(st), zap_channel_state2str(s)); \
else zap_log(ZAP_LOG_WARNING, "VETO Changing state on %d:%d from %s to %s\n", obj->span_id, obj->chan_id, zap_channel_state2str(st), zap_channel_state2str(s)); \
@@ -770,10 +770,20 @@ ZIO_CODEC_FUNCTION(zio_alaw2ulaw);
#endif
/*!
\brief Allocate uninitialized memory
\command chunksize the chunk size
\brief Assert condition
*/
#define zap_assert(assertion, retval, msg) \
#define zap_assert(assertion, msg) \
if (!(assertion)) { \
zap_log(ZAP_LOG_CRIT, msg); \
if (g_zap_crash_policy & ZAP_CRASH_ON_ASSERT) { \
abort(); \
} \
}
/*!
\brief Assert condition and return
*/
#define zap_assert_return(assertion, retval, msg) \
if (!(assertion)) { \
zap_log(ZAP_LOG_CRIT, msg); \
if (g_zap_crash_policy & ZAP_CRASH_ON_ASSERT) { \