[asterisk-dev] [Code Review] astobj2, unlinking everything in bucket instead of stopping on first match when OBJ_MULTIPLE is not used

Kevin Fleming kpfleming at digium.com
Fri Feb 5 14:16:03 CST 2010


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/490/#review1468
-----------------------------------------------------------



/trunk/main/astobj2.c
<https://reviewboard.asterisk.org/r/490/#comment3317>

    This is reverting a change that went in recently, and appears to be contradictory. USE_CONTAINER(flags) checks to see if OBJ_MULTIPLE is on and OBJ_NODATA is off, and !(flags & OBJ_MULTIPLE) checks to see if OBJ_MULTIPLE is off, but doesn't care about OBJ_NODATA.
    
    I would suggest reviewing the previous revision of this code to look how it was before it got changed, and try to understand what was wrong with it that caused it to become what it is now... there's obviously a logic flaw here.
    
    Once this is worked out, we really need to add a comment block above this conditional block that completely documents how the conditional test works and why it works that way... when I wrote it I failed to do that, and now it has been changed a couple of times and caused regressions due to the lack of commenting. It's time to fix that up... so if you need assistance in understanding the code here, feel free to ask.


- Kevin


On 2010-02-05 13:44:56, David Vossel wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/490/
> -----------------------------------------------------------
> 
> (Updated 2010-02-05 13:44:56)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> This is a trunk only problem.  If OBJ_MULTIPLE is not used, all the items in the bucket are unlinked when OBJ_UNLINK is used.
> 
> For example.  ao2_find(container, NULL, OBJ_POINTER | OBJ_UNLINK | OBJ_CONTINUE); should return the first found item, unlink it, and stop... Instead of doing that it unlinks everything in the bucket and stops.  This is not good for iax2 as every time a call number is retrieved multiple ones are unlinked never to return.
> 
> 
> Diffs
> -----
> 
>   /trunk/main/astobj2.c 245046 
> 
> Diff: https://reviewboard.asterisk.org/r/490/diff
> 
> 
> Testing
> -------
> 
> resolves the iax2 call number issue described above.
> 
> 
> Thanks,
> 
> David
> 
>




More information about the asterisk-dev mailing list