<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/8778">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Richard Mudgett: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, but someone else must approve
Corey Farrell: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Jenkins2: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">utils: Add ast_assert_return<br><br>Similar to pjproject's PJ_ASSERT_RETURN macro, this one will do the<br>following...<br><br>If the assert passes... NoOp<br><br>If the assert fails and AST_DEVMODE is defined, execute ast_assert()<br>then, if DO_CRASH isn't set, return from the calling function with<br>the supplied value.<br><br>If the assert fails and AST_DEVMODE is not defined, return from the<br>calling function with the supplied value.<br><br>The macro will execute a return without a value if one isn't suppled.<br><br>Change-Id: I0003844affeab550d5ff5bca7aa7cf8a559b873e<br>---<br>M include/asterisk/utils.h<br>1 file changed, 13 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h<br>index 290f7a3..f8f761d 100644<br>--- a/include/asterisk/utils.h<br>+++ b/include/asterisk/utils.h<br>@@ -860,6 +860,13 @@<br> <br> #ifdef AST_DEVMODE<br> #define ast_assert(a) _ast_assert(a, # a, __FILE__, __LINE__, __PRETTY_FUNCTION__)<br>+#define ast_assert_return(a, ...) \<br>+({ \<br>+ if (__builtin_expect(!(a), 1)) { \<br>+ _ast_assert(0, # a, __FILE__, __LINE__, __PRETTY_FUNCTION__); \<br>+ return __VA_ARGS__; \<br>+ }\<br>+})<br> static void force_inline _ast_assert(int condition, const char *condition_str, const char *file, int line, const char *function)<br> {<br> if (__builtin_expect(!condition, 1)) {<br>@@ -868,6 +875,12 @@<br> }<br> #else<br> #define ast_assert(a)<br>+#define ast_assert_return(a, ...) \<br>+({ \<br>+ if (__builtin_expect(!(a), 1)) { \<br>+ return __VA_ARGS__; \<br>+ }\<br>+})<br> #endif<br> <br> /*!<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/8778">change 8778</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/8778"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I0003844affeab550d5ff5bca7aa7cf8a559b873e </div>
<div style="display:none"> Gerrit-Change-Number: 8778 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>