[asterisk-dev] [Code Review] 2501: Change IAX2 "inkeys" To Use A Dynamic String Buffer

Joshua Colp reviewboard at asterisk.org
Wed May 8 12:14:57 CDT 2013



> On May 8, 2013, 3:58 p.m., Joshua Colp wrote:
> > /trunk/channels/chan_iax2.c, line 7822
> > <https://reviewboard.asterisk.org/r/2501/diff/1/?file=37206#file37206line7822>
> >
> >     Why don't you just ast_strdup this instead of using ast_str_*?
> 
> Michael Young wrote:
>     I guess that I thought this was the preferred way of working with dynamic strings in Asterisk.  Also, this is how I have observed it being done in other parts of the code and also from what I had read in doxygen (http://doxygen.asterisk.org/trunk/strings_8h-source.html) about dynamic strings support.

While it's a dynamic string you aren't manipulating it in a dynamic fashion. An ast_str is useful if you are going to keep appending data, without knowing what the end size is. In this you already know the size and can just ast_strdup it.


- Joshua


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


On May 6, 2013, 5:23 p.m., Michael Young wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2501/
> -----------------------------------------------------------
> 
> (Updated May 6, 2013, 5:23 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Bugs: ASTERISK-21398
>     https://issues.asterisk.org/jira/browse/ASTERISK-21398
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> Currently, the setting of "inkeys" is limited to 256 chars .  If the user has many keys and the names of those key files are long, the 256 chars is not enough.
> 
> This changes the "inkeys" to be a dynamic size.
> 
> 
> Diffs
> -----
> 
>   /trunk/channels/chan_iax2.c 385266 
> 
> Diff: https://reviewboard.asterisk.org/r/2501/diff/
> 
> 
> Testing
> -------
> 
> The reporter tested this on his machine where he was having a problem.  This fixed his issue.
> 
> 
> Thanks,
> 
> Michael Young
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130508/3ab885c4/attachment-0001.htm>


More information about the asterisk-dev mailing list