[asterisk-dev] [Code Review]: Add JSON support to Asterisk

David Lee reviewboard at asterisk.org
Thu Jan 10 09:39:29 CST 2013



> On Jan. 10, 2013, 2:57 a.m., wdoekes wrote:
> > /trunk/res/res_json.c, lines 357-362
> > <https://reviewboard.asterisk.org/r/2264/diff/2/?file=32776#file32776line357>
> >
> >     Ok, you're doubling it because we can expect more data in the future.
> >     
> >     But putting the make_space() call inside the loop looks inefficient.
> >     
> >     while(remaining < size) {
> >       multiplier <<= 1;
> >       remaining = ast_str_size(*dst) * multiplier - ast_str_strlen(*dst);
> >     }
> >     
> >     .. and I believe make_space() does not account for the terminating NUL that append_substr() will be adding.
> >     
> >     P.S. Should dump_str() get a load_str() friend?

Done.


- David


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


On Jan. 9, 2013, 11:26 p.m., David Lee wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2264/
> -----------------------------------------------------------
> 
> (Updated Jan. 9, 2013, 11:26 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> This provides a JSON API by pulling in and wrapping the Jansson JSON
> library[1]. The Asterisk API basically mirrors the Jansson
> functionality, with a few minor tweaks:
> 
>  * Jansson provides both reference-stealing and reference-borrowing
>    versions of several API's. The Asterisk API is exclusively
>    reference-stealing for operations that put elements into arrays and
>    objects.
>  * No support for doubles, since we usually don't need that.
>  * Coming along for the ride is the ast_test_check macro, which makes
>    it easier to accumulate the results of several operations in a test.
> 
>  [1]: http://www.digip.org/jansson/
> 
> 
> This addresses bug ASTERISK-20888.
>     https://issues.asterisk.org/jira/browse/ASTERISK-20888
> 
> 
> Diffs
> -----
> 
>   /trunk/build_tools/menuselect-deps.in 378906 
>   /trunk/configure.ac 378906 
>   /trunk/contrib/scripts/install_prereq 378906 
>   /trunk/include/asterisk/autoconfig.h.in 378906 
>   /trunk/include/asterisk/json.h PRE-CREATION 
>   /trunk/include/asterisk/test.h 378906 
>   /trunk/main/Makefile 378906 
>   /trunk/main/test.c 378906 
>   /trunk/makeopts.in 378906 
>   /trunk/res/res_json.c PRE-CREATION 
>   /trunk/res/res_json.exports.in PRE-CREATION 
>   /trunk/tests/test_json.c PRE-CREATION 
> 
> Diff: https://reviewboard.asterisk.org/r/2264/diff
> 
> 
> Testing
> -------
> 
> Behold, extensive unit tests!
> 
> 
> Thanks,
> 
> David
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130110/fbc87a64/attachment.htm>


More information about the asterisk-dev mailing list