[asterisk-dev] [Code Review] Replace nested functions with file scope functions

Mark Michelson mmichelson at digium.com
Thu Nov 6 17:54:12 CST 2008


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.digium.com/r/33/#review92
-----------------------------------------------------------



/trunk/channels/chan_sip.c
<http://reviewboard.digium.com/r/33/#comment166>

    I see what you've tried to do here. The problem is that this seems ... dangerous to me. The reason is that the next time a new OBJ_* flag value gets added to astobj2.h, we'll have to be sure to update chan_sip.c so that SIP_OBJ_FORCENAMEMATCH does not overlap with a flag defined in astobj2.h.
    
    What I would suggest doing is defining a structure which holds just a "name" and a bit representing the forcenamematch flag. tmp_peer can be a structure of that type. Set the appropriate values here in find_peer based on input to the function.
    
    Then in find_by_name, the match variable could be of this new struct type instead of being a sip_peer.


- Mark


On 2008-11-06 13:46:47, Sean Bright wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.digium.com/r/33/
> -----------------------------------------------------------
> 
> (Updated 2008-11-06 13:46:47)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> This is a patch to promote the current nested functions in asterisk trunk to file level functions based on security concerns.  For more details, see:
> 
>   http://gcc.gnu.org/ml/gcc-help/2005-12/msg00174.html
> 
> Also, I added a note to one of the calls in main/features.c which I marked with an XXX comment.
> 
> 
> Diffs
> -----
> 
>   /trunk/apps/app_dial.c 154965 
>   /trunk/apps/app_directed_pickup.c 154965 
>   /trunk/apps/app_followme.c 154965 
>   /trunk/apps/app_queue.c 154965 
>   /trunk/channels/chan_sip.c 154965 
>   /trunk/include/asterisk/channel.h 154965 
>   /trunk/main/channel.c 154965 
>   /trunk/main/features.c 154965 
> 
> Diff: http://reviewboard.digium.com/r/33/diff
> 
> 
> Testing
> -------
> 
> This passes the 'make' test with dev-mode enabled, but I have not functionally tested extensively.
> 
> 
> Thanks,
> 
> Sean
> 
>




More information about the asterisk-dev mailing list