<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/1732/">https://reviewboard.asterisk.org/r/1732/</a>
     </td>
    </tr>
   </table>
   <br />









<div>




<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/1732/diff/1/?file=24082#file24082line5809" style="color: black; font-weight: bold; text-decoration: underline;">/trunk/apps/app_rpt.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; ">struct ast_format_cap *cap = NULL;</pre></td>

  </tr>
 </tbody>



 
 




 <tbody>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">5803</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="ew">                </span><span class="n">str<span class="hl">ncpy</span></span><span class="p">(</span><span class="n">deststr</span><span class="p">,</span> <span class="n">s1</span><span class="p">,</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">deststr</span><span class="p">));</span></pre></td>
    <th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">5809</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="ew">                </span><span class="n"><span class="hl">ast_copy_</span>str<span class="hl">ing</span></span><span class="p">(</span><span class="n">deststr</span><span class="p">,</span> <span class="n">s1</span><span class="p">,</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">deststr</span><span class="p">));</span></pre></td>
  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Would be nice to get rid of the red blobs, especially on lines that you&#39;re editing.</pre>
</div>
<br />

<div>




<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/1732/diff/1/?file=24082#file24082line13057" style="color: black; font-weight: bold; text-decoration: underline;">/trunk/apps/app_rpt.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; ">char *this,*val;</pre></td>

  </tr>
 </tbody>






 
 

 <tbody>

  <tr>
    <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">13027</font></th>
    <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                                <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">strcmp</span><span class="p">(</span><span class="n">rpt_vars</span><span class="p">[</span><span class="n">i</span><span class="p">].</span><span class="n">remoterig</span><span class="p">,</span><span class="n">remote_rig_rtx450</span><span class="p">))</span></pre></td>
    <th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">13057</font></th>
    <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                                <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">strcmp</span><span class="p">(</span><span class="n">rpt_vars</span><span class="p">[</span><span class="n">i</span><span class="p">].</span><span class="n">remoterig</span><span class="p">,</span><span class="n">remote_rig_rtx450</span><span class="p">))</span></pre></td>
  </tr>

 </tbody>


 
 




 <tbody>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">13028</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                                        <span class="n">strncpy</span><span class="p">(</span><span class="n">rpt_vars</span><span class="p">[</span><span class="n">i</span><span class="p">].</span><span class="n">freq</span><span class="p">,</span> <span class="s">&quot;446.500&quot;</span><span class="p">,</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">rpt_vars</span><span class="p">[</span><span class="n">i</span><span class="p">].</span><span class="n">freq</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">);</span></pre></td>
    <th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">13058</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                                        <span class="n">ast_copy_string</span><span class="p">(</span><span class="n">rpt_vars</span><span class="p">[</span><span class="n">i</span><span class="p">].</span><span class="n">freq</span><span class="p">,</span></pre></td>
  </tr>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">13029</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                                <span class="k">else</span></pre></td>
    <th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">13059</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                                                        <span class="s">&quot;446.500&quot;</span><span class="p">,</span></pre></td>
  </tr>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">13030</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                                        <span class="n">strncpy</span><span class="p">(</span><span class="n">rpt_vars</span><span class="p">[</span><span class="n">i</span><span class="p">].</span><span class="n">freq</span><span class="p">,</span> <span class="s">&quot;146.580&quot;</span><span class="p">,</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">rpt_vars</span><span class="p">[</span><span class="n">i</span><span class="p">].</span><span class="n">freq</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">);</span></pre></td>
    <th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">13060</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                                                        <span class="k">sizeof</span><span class="p">(</span><span class="n">rpt_vars</span><span class="p">[</span><span class="n">i</span><span class="p">].</span><span class="n">freq</span><span class="p">));</span></pre></td>
  </tr>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">13031</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                                <span class="n">strncpy</span><span class="p">(</span><span class="n">rpt_vars</span><span class="p">[</span><span class="n">i</span><span class="p">].</span><span class="n">rxpl</span><span class="p">,</span> <span class="s">&quot;100.0&quot;</span><span class="p">,</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">rpt_vars</span><span class="p">[</span><span class="n">i</span><span class="p">].</span><span class="n">rxpl</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">);</span></pre></td>
    <th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">13061</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                                <span class="k">else</span></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">13062</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                                        <span class="n">ast_copy_string</span><span class="p">(</span><span class="n">rpt_vars</span><span class="p">[</span><span class="n">i</span><span class="p">].</span><span class="n">freq</span><span class="p">,</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">13063</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                                                        <span class="s">&quot;146.580&quot;</span><span class="p">,</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">13064</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                                                        <span class="k">sizeof</span><span class="p">(</span><span class="n">rpt_vars</span><span class="p">[</span><span class="n">i</span><span class="p">].</span><span class="n">freq</span><span class="p">));</span></pre></td>
  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Holy lack of curley braces, Batman!</pre>
</div>
<br />

<div>




<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/1732/diff/1/?file=24085#file24085line1972" style="color: black; font-weight: bold; text-decoration: underline;">/trunk/res/ael/ael_lex.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; ">YY_RULE_SETUP</pre></td>

  </tr>
 </tbody>



 
 




 <tbody>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">1972</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                        <span class="n">str<span class="hl">ncpy</span></span><span class="p">(</span><span class="n">fnamebuf</span><span class="p">,</span> <span class="n">p1</span><span class="o"><span class="hl">+</span></span><span class="mi">1</span><span class="p">,</span> <span class="n">p2</span><span class="o"><span class="hl">-</span></span><span class="n"><span class="hl">p1</span></span><span class="o"><span class="hl">-</span></span><span class="mi">1</span><span class="p">);</span></pre></td>
    <th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">1972</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                        <span class="n"><span class="hl">ast_copy_</span>str<span class="hl">ing</span></span><span class="p">(</span><span class="n">fnamebuf</span><span class="p">,</span> <span class="n">p1</span> <span class="o"><span class="hl">+</span></span><span class="hl"> </span><span class="mi">1</span><span class="p">,</span> <span class="n">p2</span> <span class="o"><span class="hl">-</span></span><span class="hl"> </span><span class="n"><span class="hl">p</span>1</span><span class="p">);</span></pre></td>
  </tr>

 </tbody>





 
 

 <tbody>

  <tr>
    <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">1973</font></th>
    <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                        <span class="n">fnamebuf</span><span class="p">[</span><span class="n">p2</span><span class="o">-</span><span class="n">p1</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span></pre></td>
    <th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">1973</font></th>
    <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                        <span class="n">fnamebuf</span><span class="p">[</span><span class="n">p2</span><span class="o">-</span><span class="n">p1</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span></pre></td>
  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Keep the -1 on the end here, or you&#39;ll copy the ending quote, which is not what you want.  However, you CAN get rid of the line following, as it becomes redundant with the use of ast_copy_string().</pre>
</div>
<br />

<div>




<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/1732/diff/1/?file=24086#file24086line272" style="color: black; font-weight: bold; text-decoration: underline;">/trunk/res/snmp/agent.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; ">static u_char *ast_var_channels_table(struct variable *vp, oid *name, size_t *length,</pre></td>

  </tr>
 </tbody>



 
 




 <tbody>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">272</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                        <span class="n">str<span class="hl">ncpy</span></span><span class="p">(</span><span class="n">string_ret</span><span class="p">,</span> <span class="n">ast_channel_name</span><span class="p">(</span><span class="n">chan</span><span class="p">),</span><span class="hl"> </span><span class="k"><span class="hl">sizeof</span></span><span class="p"><span class="hl">(</span></span><span class="n"><span class="hl">string_ret</span></span><span class="p"><span class="hl">));</span></span></pre></td>
    <th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">272</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                        <span class="n"><span class="hl">ast_copy_</span>str<span class="hl">ing</span></span><span class="p">(</span><span class="n">string_ret</span><span class="p">,</span> <span class="n">ast_channel_name</span><span class="p">(</span><span class="n">chan</span><span class="p">),</span></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">273</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                                        <span class="k">sizeof</span><span class="p">(</span><span class="n">string_ret</span><span class="p">));</span></pre></td>
  </tr>

 </tbody>





 
 

 <tbody>

  <tr>
    <th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">273</font></th>
    <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                        <span class="n">string_ret</span><span class="p">[</span><span class="k">sizeof</span><span class="p">(</span><span class="n">string_ret</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="sc">&#39;\0&#39;</span><span class="p">;</span></pre></td>
    <th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">274</font></th>
    <td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                        <span class="n">string_ret</span><span class="p">[</span><span class="k">sizeof</span><span class="p">(</span><span class="n">string_ret</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="sc">&#39;\0&#39;</span><span class="p">;</span></pre></td>
  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">As in the previous file, once you change to ast_copy_string, you can get rid of the following line, which redundantly places a terminating NULL.</pre>
</div>
<br />

<div>




<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/1732/diff/1/?file=24089#file24089line82" style="color: black; font-weight: bold; text-decoration: underline;">/trunk/utils/db1-ast/hash/ndbm.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; ">dbm_open(file, flags, mode)</pre></td>

  </tr>
 </tbody>



 
 




 <tbody>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">82</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="n">str<span class="hl">ncpy</span></span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="n">file</span><span class="p">,</span> <span class="n">len</span><span class="hl"> </span><span class="o"><span class="hl">-</span></span><span class="hl"> </span><span class="mi"><span class="hl">1</span></span><span class="p">);</span></pre></td>
    <th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">82</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="n"><span class="hl">ast_copy_</span>str<span class="hl">ing</span></span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="n">file</span><span class="p">,</span> <span class="n">len</span><span class="p">);</span></pre></td>
  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">You can drop the (void).  ast_copy_string() already returns void.</pre>
</div>
<br />

<div>




<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/1732/diff/1/?file=24090#file24090line152" style="color: black; font-weight: bold; text-decoration: underline;">/trunk/utils/muted.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; ">static int load_config(void)</pre></td>

  </tr>
 </tbody>



 
 




 <tbody>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">152</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                                        <span class="n">strncpy</span><span class="p">(</span><span class="n">host</span><span class="p">,</span> <span class="n">val</span><span class="p">,</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">host</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span><span class="p">);</span></pre></td>
    <th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">152</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                                        <span class="n">ast_copy_string</span><span class="p">(</span><span class="n">host</span><span class="p">,</span> <span class="n">val</span><span class="p">,</span></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">153</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">                                                        <span class="k">sizeof</span><span class="p">(</span><span class="n">host</span><span class="p">));</span></pre></td>
  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Why are we wrapping these lines, when the following lines are much longer?</pre>
</div>
<br />



<p>- Tilghman</p>


<br />
<p>On February 10th, 2012, 8:29 p.m., Terry Wilson 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 Terry Wilson.</div>


<p style="color: grey;"><i>Updated Feb. 10, 2012, 8:29 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;">One of the janitor projects is to replace strncpy with ast_copy_string where possible. As a brief example of using the coccinelle tool, I thought I&#39;d post an example for using it. There are some cases of strncpy which where ast_copy_string wouldn&#39;t be appropriate--sepcifically when it is used to copy non-NULL terminated buffers (instead of memcpy, which should be used for that). Two cases that I think should be completely safe are where we have something like strncpy(src, dst, ${something} - 1) and strncpy(src, dst, sizeof(src)) (which is a bug waiting to happen). 

Here is the coccinelle patch to do the translation:

strncpy.cocci
@@
expression a, b, c;
@@

- strncpy(a, b, c - 1)
+ ast_copy_string(a, b, c)

@@
expression a, b;
@@

- strncpy(a, b, sizeof(a))
+ ast_copy_string(a, b, sizeof(a))

Coccinelle needs a little help with some of the macros in Asterisk--so far it looks like the ones in linkedlists.h and app.h give it the most trouble. You can generate a macro file to use by doing:

spatch -extract_macros include/asterisk/linkedlists.h &gt; /tmp/spatch.h
spatch -extract_macros include/asterisk/app.h &gt;&gt; /tmp/spatch.h

I&#39;ve found that doing all of the includes sometimes makes it miss stuff for some reason...

Then to run the patch file on all the files in the asterisk directory:
spatch -sp_file strncpy.cocci -preprocess -c -in_place -I include/ -local_includes -macro_file /tmp/spatch.h -smpl_spacing -dir .

You may have to fix some stuff up manually, but it goes a long way to making things a lot easier. This is a simple example of how the channel opaquification is done. I&#39;ll write this all up on the Wiki, but am basically just doing a quick brain dump before I leave for the night.</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;">It compiles.</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/addons/chan_ooh323.c <span style="color: grey">(354785)</span></li>

 <li>/trunk/addons/ooh323c/src/ooCalls.c <span style="color: grey">(354785)</span></li>

 <li>/trunk/addons/ooh323c/src/ooCmdChannel.c <span style="color: grey">(354785)</span></li>

 <li>/trunk/addons/ooh323c/src/ooh323ep.c <span style="color: grey">(354785)</span></li>

 <li>/trunk/addons/ooh323c/src/ooq931.c <span style="color: grey">(354785)</span></li>

 <li>/trunk/apps/app_rpt.c <span style="color: grey">(354785)</span></li>

 <li>/trunk/channels/iax2-provision.c <span style="color: grey">(354785)</span></li>

 <li>/trunk/pbx/dundi-parser.c <span style="color: grey">(354785)</span></li>

 <li>/trunk/res/ael/ael_lex.c <span style="color: grey">(354785)</span></li>

 <li>/trunk/res/snmp/agent.c <span style="color: grey">(354785)</span></li>

 <li>/trunk/utils/ael_main.c <span style="color: grey">(354785)</span></li>

 <li>/trunk/utils/astman.c <span style="color: grey">(354785)</span></li>

 <li>/trunk/utils/db1-ast/hash/ndbm.c <span style="color: grey">(354785)</span></li>

 <li>/trunk/utils/muted.c <span style="color: grey">(354785)</span></li>

</ul>

<p><a href="https://reviewboard.asterisk.org/r/1732/diff/" style="margin-left: 3em;">View Diff</a></p>




  </td>
 </tr>
</table>








  </div>
 </body>
</html>