<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/1572/">https://reviewboard.asterisk.org/r/1572/</a>
</td>
</tr>
</table>
<br />
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Thanks for the review! Will post updated version asap.</pre>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On December 6th, 2011, 12:15 p.m., <b>mjordan</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/1572/diff/1/?file=21657#file21657line11823" style="color: black; font-weight: bold; text-decoration: underline;">/branches/1.8/apps/app_voicemail.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="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">static int load_config_from_memory(int reload, struct ast_config *cfg, struct ast_config *ucfg)</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">11816</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="k">static</span> <span class="kt">int</span> <span class="nf">load_config_from_memory</span><span class="p">(</span><span class="kt">int</span> <span class="n">reload</span><span class="p">,</span> <span class="k">struct</span> <span class="n">ast_config</span> <span class="o">*</span><span class="n">cfg</span><span class="p">,</span> <span class="k">struct</span> <span class="n">ast_config</span> <span class="o">*</span><span class="n">ucfg</span><span class="p">)</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;">This looks like its only called from your unit tests. Was that intended?
If so, you should probably surround it by TEST_FRAMEWORK tags (and maybe rename it to reflect that its test only)</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;">Good point. Will do that.</pre>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On December 6th, 2011, 12:15 p.m., <b>mjordan</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/1572/diff/1/?file=21657#file21657line12978" style="color: black; font-weight: bold; text-decoration: underline;">/branches/1.8/apps/app_voicemail.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="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">AST_TEST_DEFINE(test_voicemail_load_config)</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">12966</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span class="k">if</span> <span class="p">((</span><span class="n">fd</span> <span class="o">=</span> <span class="n">mkstemp</span><span class="p">(</span><span class="n">config_filename</span><span class="p">))</span> <span class="o"><</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</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;">If you don't want to make a temporary file, you can also create an ast_config object manually and add categories, variables, etc. in code.
This way works fine, but just something to keep in mind.</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;">Yeah I know. I started out doing that, but it became one giant heap of code quickly. I figured this was the easiest way to create/adjust a working config quickly.</pre>
<br />
<p>- wdoekes</p>
<br />
<p>On November 8th, 2011, 3:04 p.m., wdoekes wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/media/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.</div>
<div>By wdoekes.</div>
<p style="color: grey;"><i>Updated Nov. 8, 2011, 3:04 p.m.</i></p>
<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;">Added a regression test for my fix in r1570. It's not real pretty, but it does the job: show that the config load order is slightly broken.
Regard it as a stub that could be expanded whenever someone wants to fiddle with the app_voicemail configuration options.</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;">The test case does this, until r1570 is committed: first run fails, second run succeeds.
*CLI> test execute category /apps/app_voicemail/ name test_voicemail_load_config
Running all available tests matching category /apps/app_voicemail/ and name test_voicemail_load_config
START /apps/app_voicemail/ - test_voicemail_load_config
[app_voicemail.c:test_voicemail_load_config:13002]: mailbox 00000002 should have locale 'de_DE.UTF-8', but has ''
Failed to load configuration file.
END /apps/app_voicemail/ - test_voicemail_load_config Time: <1ms Result: FAIL
1 Test(s) Executed 0 Passed 1 Failed
*CLI> test execute category /apps/app_voicemail/ name test_voicemail_load_config
Running all available tests matching category /apps/app_voicemail/ and name test_voicemail_load_config
START /apps/app_voicemail/ - test_voicemail_load_config
Failed to load configuration file.
END /apps/app_voicemail/ - test_voicemail_load_config Time: <1ms Result: PASS
1 Test(s) Executed 1 Passed 0 Failed*CLI> test execute category /apps/app_voicemail/ name test_voicemail_load_config
Running all available tests matching category /apps/app_voicemail/ and name test_voicemail_load_config
START /apps/app_voicemail/ - test_voicemail_load_config
[app_voicemail.c:test_voicemail_load_config:13002]: mailbox 00000002 should have locale 'de_DE.UTF-8', but has ''
Failed to load configuration file.
END /apps/app_voicemail/ - test_voicemail_load_config Time: <1ms Result: FAIL
1 Test(s) Executed 0 Passed 1 Failed
*CLI> test execute category /apps/app_voicemail/ name test_voicemail_load_config
Running all available tests matching category /apps/app_voicemail/ and name test_voicemail_load_config
START /apps/app_voicemail/ - test_voicemail_load_config
Failed to load configuration file.
END /apps/app_voicemail/ - test_voicemail_load_config Time: <1ms Result: PASS
1 Test(s) Executed 1 Passed 0 Failed
When r1570 is also applied, the first run of test succeeds too, like expected.</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>/branches/1.8/apps/app_voicemail.c <span style="color: grey">(343951)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/1572/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>