[asterisk-dev] [Code Review] SIP peers & IAX2 users/peers AstData providers and unit testing.

David Vossel dvossel at digium.com
Tue May 4 09:43:35 CDT 2010


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


These are just a couple of minor comments about the unit tests.


/trunk/channels/chan_iax2.c
<https://reviewboard.asterisk.org/r/642/#comment4184>

    When writing unit tests, we commonly add a ast_test_status_update() call right before returning a failure with a description of what failed.  This is helpful when there are multiple failure points in a test.



/trunk/channels/chan_sip.c
<https://reviewboard.asterisk.org/r/642/#comment4186>

    You could just unref the peer after linking it here since the link results in a second ref. This would mean using unlink later on the peer would also destroy it since it removes the last remaining ref. 



/trunk/channels/chan_sip.c
<https://reviewboard.asterisk.org/r/642/#comment4185>

    In almost all these failure checks and at the end of the function you have to do 3 things, unlink the peer, unref the peer, and free the node.  goto's have a bad reputation, but using a goto here to return a failure that jumps to the end of the function to do clean up is a good use.  This will reduce the amount of code required as well.


- David


On 2010-05-03 13:47:50, Eliel Sardañons wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/642/
> -----------------------------------------------------------
> 
> (Updated 2010-05-03 13:47:50)
> 
> 
> Review request for Asterisk Developers and Tilghman Lesher.
> 
> 
> Summary
> -------
> 
> - AstData Search engine modified to simplify each data provider.
> - SIP peers/users data provider + unit testing.
> - IAX2 peers/users data provider + unit testing.
> 
> 
> Diffs
> -----
> 
>   /trunk/apps/app_queue.c 260752 
>   /trunk/apps/app_voicemail.c 260752 
>   /trunk/channels/chan_iax2.c 260752 
>   /trunk/channels/chan_sip.c 260752 
>   /trunk/include/asterisk/data.h 260752 
>   /trunk/main/channel.c 260752 
>   /trunk/main/data.c 260752 
> 
> Diff: https://reviewboard.asterisk.org/r/642/diff
> 
> 
> Testing
> -------
> 
> Developer testing.
> 
> 
> Thanks,
> 
> Eliel
> 
>




More information about the asterisk-dev mailing list