[asterisk-dev] [Code Review] Finish implementaton of astobj2 OBJ_MULTIPLE, and convert ast_channel_iterator to use it.

Sean Bright sean.bright at gmail.com
Tue Oct 6 12:11:36 CDT 2009



> On 2009-10-06 12:01:48, Sean Bright wrote:
> > /trunk/main/astobj2.c, line 760
> > <https://reviewboard.asterisk.org/r/379/diff/5/?file=6612#file6612line760>
> >
> >     multi_iterator is only ever used from this block, so we could probably move it's definition and allocation here as well.
> 
>  wrote:
>     I did that initially, but then opted to move it in case allocation of the memory for the iterator should fail; if that happens, it's best to just abort the entire operation early, rather than filling the container and then throwing it away.

If we are out of memory, the calls to ao2_link() are going to (most likely) fail as well, so it's moot.  But point taken.


- Sean


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


On 2009-10-06 11:25:00, Kevin Fleming wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/379/
> -----------------------------------------------------------
> 
> (Updated 2009-10-06 11:25:00)
> 
> 
> Review request for Asterisk Developers and Russell Bryant.
> 
> 
> Summary
> -------
> 
> This patch finishes the implementation of OBJ_MULTIPLE in astobj2 (the case where multiple results need to be returned; OBJ_NODATA mode already was supported). In addition, it converts ast_channel_iterators (only the targeted versions, not the ones that iterate over all channels) to use this method.
> 
> The patch is not yet complete, as astobj2.h needs some editing to document the new structures and remove the existing comments about limitations of OBJ_MULTIPLE, but the functional parts should be complete.
> 
> During this work, I removed the 'ao2_flags' arguments to the ast_channel_iterator constructor functions; there were no uses of that argument yet, there is only one possible flag to pass, and it made the iterators less 'opaque'. If at some point in the future someone really needs an ast_channel_iterator that does not lock the container, we can provide constructor(s) for that purpose.
> 
> 
> Diffs
> -----
> 
>   /trunk/apps/app_chanspy.c 222222 
>   /trunk/apps/app_directed_pickup.c 222222 
>   /trunk/apps/app_softhangup.c 222222 
>   /trunk/funcs/func_channel.c 222222 
>   /trunk/include/asterisk/astobj2.h 222222 
>   /trunk/include/asterisk/channel.h 222222 
>   /trunk/include/asterisk/lock.h 222222 
>   /trunk/main/astobj2.c 222222 
>   /trunk/main/channel.c 222222 
>   /trunk/main/cli.c 222222 
>   /trunk/main/manager.c 222222 
>   /trunk/res/snmp/agent.c 222222 
> 
> Diff: https://reviewboard.asterisk.org/r/379/diff
> 
> 
> Testing
> -------
> 
> Tested 'core show channels' and channel tab-completion with 'channel request hangup' with four active channels, and everything worked properly, with no discernible memory leaks.
> 
> 
> Thanks,
> 
> Kevin
> 
>




More information about the asterisk-dev mailing list