<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://reviewboard.asterisk.org/r/2579/">https://reviewboard.asterisk.org/r/2579/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On May 30th, 2013, 11:44 p.m. CDT, <b>opticron</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I'm not so sure that NULL-safety on a ao2_ref variant is such a good idea when ao2_ref is not NULL-safe.
Be ready to lose a merge race on the confbridge changes.</pre>
</blockquote>
<p>On May 31st, 2013, 2:20 p.m. CDT, <b>Matt Jordan</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I'm with Kinsey on this one. While I can certainly see why you're doing it - checking each return and returning NULL and on the success path bumping it by one and returning the same pointer is a bit tedious - it feels like this could be abused. In general, people shouldn't be ref bumping something that is NULL.</pre>
</blockquote>
</blockquote>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Okay, fine. But if my fingers fall off from the extra typing, I blame you two!</pre>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On May 30th, 2013, 11:44 p.m. CDT, <b>opticron</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="https://reviewboard.asterisk.org/r/2579/diff/1/?file=38866#file38866line148" style="color: black; font-weight: bold; text-decoration: underline;">/trunk/main/stasis_message.c</a>
<span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">const struct timeval *stasis_message_timestamp(const struct stasis_message *msg)</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">148</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="cp"><span class="tb">        </span><span class="tb">        </span>if (msg == NULL) {<span class="tb">        </span><span class="tb">        </span><span class="tb">        </span>\</span></pre></td>
</tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">149</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="cp"><span class="tb">        </span><span class="tb">        </span><span class="tb">        </span>return NULL;<span class="tb">        </span><span class="tb">        </span><span class="tb">        </span>\</span></pre></td>
</tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">150</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="cp"><span class="tb">        </span><span class="tb">        </span>}<span class="tb">        </span><span class="tb">        </span><span class="tb">        </span><span class="tb">        </span><span class="tb">        </span>\</span></pre></td>
</tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I'm not sure it's ever reasonable to blindly invoke a virtual function on a NULL message. A message that failed allocation should never be published.</pre>
</blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">It's true that the message won't be published, but there are other use cases where you end up with a NULL message (such as with caching). It's easy enough to make the function NULL safe, so I'm sticking with it.</pre>
<br />
<p>- David</p>
<br />
<p>On May 30th, 2013, 10:42 p.m. CDT, David Lee wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/static/rb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for Asterisk Developers, Matt Jordan and Jason Parker.</div>
<div>By David Lee.</div>
<p style="color: grey;"><i>Updated May 30, 2013, 10:42 p.m.</i></p>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>
<a href="https://issues.asterisk.org/jira/browse/ASTERISK-21817">ASTERISK-21817</a>
</div>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
Asterisk
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">When a Stasis message type is defined in a loadable module, handling
those messages for AMI and res_stasis events can be cumbersome.
This patch adds a vtable to stasis_message_type, with to_ami and
to_json virtual functions. These allow messages to be handled
abstractly without putting module-specific code in core.
As an example, the VarSet AMI event was refactored to use the to_ami
virtual function.
Additionally, I finally got tired of the boilerplate incrementing AO2
refcounts, so I added an ao2_ref1() macro, which is NULL safe and
returns the object.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Unit tests.
Verified that the VarSet event still looked the way it ought to.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>/trunk/apps/confbridge/confbridge_manager.c <span style="color: grey">(390151)</span></li>
<li>/trunk/include/asterisk/astobj2.h <span style="color: grey">(390151)</span></li>
<li>/trunk/include/asterisk/manager.h <span style="color: grey">(390151)</span></li>
<li>/trunk/include/asterisk/stasis.h <span style="color: grey">(390151)</span></li>
<li>/trunk/main/manager.c <span style="color: grey">(390151)</span></li>
<li>/trunk/main/manager_channels.c <span style="color: grey">(390151)</span></li>
<li>/trunk/main/parking.c <span style="color: grey">(390151)</span></li>
<li>/trunk/main/stasis_channels.c <span style="color: grey">(390151)</span></li>
<li>/trunk/main/stasis_message.c <span style="color: grey">(390151)</span></li>
<li>/trunk/tests/test_astobj2.c <span style="color: grey">(390151)</span></li>
<li>/trunk/tests/test_stasis.c <span style="color: grey">(390151)</span></li>
<li>/trunk/tests/test_stasis_channels.c <span style="color: grey">(390151)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/2579/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>