[Asterisk-code-review] utils: Add ast assert else (asterisk[13])

Richard Mudgett asteriskteam at digium.com
Fri Apr 13 18:25:14 CDT 2018


Richard Mudgett has posted comments on this change. ( https://gerrit.asterisk.org/8778 )

Change subject: utils:  Add ast_assert_else
......................................................................


Patch Set 2:

A better definition would be:

#define ast_assert_return(a, ret_val) (if (__builtin_expect(!(a), 1)) { \
	_ast_assert(0, # a, __FILE__, __LINE__, __PRETTY_FUNCTION__); \
	return ret_val; \
})

* Note that this limits to just specifying the function return value.

* Note the isolating parentheses around the whole macro.  These prevent tacking other things onto the expression if the trailing semicolon is missing.

ast_assert_return(cfg, NULL);
ast_assert_return(conf, -1);
ast_assert_return(event,);  <- Note no return value.


-- 
To view, visit https://gerrit.asterisk.org/8778
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: comment
Gerrit-Change-Id: I0003844affeab550d5ff5bca7aa7cf8a559b873e
Gerrit-Change-Number: 8778
Gerrit-PatchSet: 2
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Comment-Date: Fri, 13 Apr 2018 23:25:14 +0000
Gerrit-HasComments: No
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180413/19d45edc/attachment.html>


More information about the asterisk-code-review mailing list