<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 />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On May 18th, 2011, 3:54 p.m., <b>davidw</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 believe it will work, however I did think of a possibly neater way of doing it on my way back to the office (I also realised it failed to creating extension -1, rather than typically 700).
I'll have to see if I have time to actually formalise it. Basically do the exit condition by normal C for mechanisms and move the wrapround test to the end, with some tweaking.</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;">Bleh. Looks like I'm still getting it to exit and parking on -1 afterall. Must have missed something while testing it.</pre>
<br />
<p>- jrose</p>
<br />
<p>On May 18th, 2011, 3:10 p.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-18 15:10:55</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'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'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'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't this is very much one of those 'once in a while' situations where we probably don'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>