[Asterisk-code-review] ARI: Added new functionality to get all module information. (asterisk[13])

Matt Jordan asteriskteam at digium.com
Fri Jun 26 16:13:37 CDT 2015


Matt Jordan has posted comments on this change.

Change subject: ARI: Added new functionality to get all module information.
......................................................................


Patch Set 1:

(3 comments)

https://gerrit.asterisk.org/#/c/732/1/include/asterisk/module.h
File include/asterisk/module.h:

Line 171:  *
        :  * \return the number of modules loaded
        :  */
Add a \since 13.5.0 here, as this is a new public API function.


https://gerrit.asterisk.org/#/c/732/1/res/ari/resource_asterisk.c
File res/ari/resource_asterisk.c:

Line 163: 	module_info = ast_json_pack("{s: s, s: s, s: i, s: s, s: s}",
        : 															"name", module,
        : 															"description", description,
        : 															"use_count", usecnt,
        : 															"status", status,
        : 													
> It looks like something got messed up here. This is missing the arguments f
Done


Line 180: 	RAII_VAR(struct ast_json *, json, NULL, ast_json_unref);
While I'm sure this is (ab)used elsewhere, RAII_VAR really isn't needed here. Generally, you really only need RAII_VAR when you have multiple return paths out of a function.

Instead, I'd write this as:

struct ast_json *json;

json = ast_json_array_create();
ast_update_module_list_data(&process_module_list, NULL, json);

ast_ari_response_ok(response, json);


Note that you don't need to bump the ref of json when passing it to ast_ari_response_ok, as that is reference stealing, and the ast_json_ref there existed to offset the unref in the RAII_VAR.


-- 
To view, visit https://gerrit.asterisk.org/732
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I63cbbf0ec0c3544cc45ed2a588dceabe91c5e0b0
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
Gerrit-HasComments: Yes



More information about the asterisk-code-review mailing list