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



 <p>Ship it!</p>



 <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Great work! The code looks correct, as long as this has been tested both using and not using the &#39;R&#39; option this should be good to go.</pre>
 <br />







<p>- David</p>


<br />
<p>On May 19th, 2011, 11:17 a.m., jrose wrote:</p>






<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.orgrb/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 and David Vossel.</div>
<div>By jrose.</div>


<p style="color: grey;"><i>Updated 2011-05-19 11:17:09</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;">Deals with some issues with the randomize option in Park().  Parking would result in a low starting extension ranging from 0 to the difference in the parkinglot&#39;s last extension and first extension.  This was just an issue of someone forgetting to add the start value to the random value.  After that I found that if it wrapped around before selecting a parking extension, and if the chosen parking extension from the random wasn&#39;t just the first extension in the available extensions list, the parking function would get mess up and the parking extension would be set to -1 which was allowed for some reason.

To address this, I made it so that if randomize mode is enabled, and if the random parking lot picked wasn&#39;t the first one in the list, a loop value would be raised so that the exit conditions would be able to tell if there were unchecked parking extensions and start iterating from the beginning if it reached that point.  Now all extensions get checked and there is no longer an opportunity for a false exit of the loop.

This does have a small performance impact with a worse case scenario of adding n-1 additional extension checks where n is the number of parking extensions available in the parking lot.  This will only be the case if the parking lot is full and the chosen parking extension from the random value is the one immediately after the first.  It could be done better possibly by holding onto the first extension checked so that the loop could be terminated early if it reached that repetition point.  This would require extra evaluations during every step though, so the performance increase might be non-existent, and even if it isn&#39;t this is very much one of those &#39;once in a while&#39; situations where we probably don&#39;t care if it takes a little extra time to evaluate.</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;">Simple 3 slot parking check.  Nothing to write home about.  Observed with multiple different starting values for behavior.</pre>
  </td>
 </tr>
</table>



<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/view.php?id=18862">18862</a>


</div>


<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/main/features.c <span style="color: grey">(319525)</span></li>

</ul>

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




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








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