[asterisk-dev] [Code Review] 3089: Presenting AO2_ITERATOR_SAFE_LOOP_START() for ao2_iterator looping safety.

Mark Michelson reviewboard at asterisk.org
Fri Jan 3 11:12:14 CST 2014


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


So...I just don't really like this.

1) Making a macro like this makes the code more esoteric than it previously was.
2) The fact that the loop_obj has to be NULLed out before breaking or returning from the loop if no reference manipulation is required makes it more likely for us to miss referencing errors during review. Plus, those referencing errors would likely be more catastrophic than the previously-missing ao2_iterator_destroy() calls.

- Mark Michelson


On Dec. 20, 2013, 10:47 p.m., rmudgett wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/3089/
> -----------------------------------------------------------
> 
> (Updated Dec. 20, 2013, 10:47 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> Due to repeated errors in people remembering to call ao2_iterator_destroy() I have created the AO2_ITERATOR_SAFE_LOOP_START() / AO2_ITERATOR_SAFE_LOOP_END macros.  Usage examples are documented where these macros are declared.
> 
> 
> Diffs
> -----
> 
>   /branches/12/tests/test_stasis.c 404437 
>   /branches/12/include/asterisk/astobj2.h 404437 
> 
> Diff: https://reviewboard.asterisk.org/r/3089/diff/
> 
> 
> Testing
> -------
> 
> No memory leaks from running "test execute category /stasis/core/ name cache_dump".
> 
> 
> Thanks,
> 
> rmudgett
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20140103/674cbbdc/attachment.html>


More information about the asterisk-dev mailing list