[Asterisk-code-review] func_groupcount.c: Adding Group Variables + additional Group functions (asterisk[18])

Mark Murawski asteriskteam at digium.com
Sat Jan 14 15:04:32 CST 2023


Attention is currently required from: N A.

Mark Murawski has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/17655 )

Change subject: func_groupcount.c: Adding Group Variables + additional Group functions
......................................................................


Patch Set 21:

(8 comments)

File funcs/func_groupcount.c:

https://gerrit.asterisk.org/c/asterisk/+/17655/comment/dec3fb5d_53ed767a 
PS21, Line 1186:         buf[1] = '\0';
> whitespace issue
Done


https://gerrit.asterisk.org/c/asterisk/+/17655/comment/9ffede78_0c2d488a 
PS21, Line 1253: 	snprintf(groups_ret, sizeof(groups_ret), "%d", groups);
> Couldn't you just snprintf into buf directly? Why the intermediate buffer?
Done


https://gerrit.asterisk.org/c/asterisk/+/17655/comment/48c8cfa0_3d6e0dd3 
PS21, Line 1419: 		return 0;
> This should return -1
Done


File main/app.c:

https://gerrit.asterisk.org/c/asterisk/+/17655/comment/89b53946_327b6439 
PS21, Line 2423: int ast_app_group_set_var(struct ast_channel *chan, const char *group, const char *category, const char *name, const char *value) {
> Opening brace should be on a separate line
Done


https://gerrit.asterisk.org/c/asterisk/+/17655/comment/7f613986_ed119f9e 
PS21, Line 2431: 		return 0;
> I see in the documentation we return 0 on failure and 1 on success, but why is that?
Fixed to be normalized with standard asterisk fn returns


https://gerrit.asterisk.org/c/asterisk/+/17655/comment/b5aa5168_dcc067f6 
PS21, Line 2444: 	AST_RWLIST_TRAVERSE_SAFE_BEGIN(&groups_meta, gmi, group_meta_list) {
> != 0 is unnecessary here
Same this as below... being explicit about what we're looking for.

Certainly this can be changed if it bugs you that much!


https://gerrit.asterisk.org/c/asterisk/+/17655/comment/eef22b61_226a7691 
PS21, Line 2479: 	if (newvariable == NULL) {
> Could just do !newvariable

I kind of remember being told the opposite (regarding coding standards for Asterisk... to be more explicit about compariters and not to rely on default behaviors of !


https://gerrit.asterisk.org/c/asterisk/+/17655/comment/915730a8_eaaf4ac2 
PS21, Line 2854: int ast_app_group_meta_wrlock(void)
> I must be missing something, but why are these functions here? I see them in the header file, and here, why are they needed?

It's for allowing direct access to the groups/meta list in func_groupcount. The others that aren't used currently were added for consistency.



-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/17655
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 18
Gerrit-Change-Id: I23e48d1cdfc8adaffdfec2e936e56143603914f2
Gerrit-Change-Number: 17655
Gerrit-PatchSet: 21
Gerrit-Owner: Mark Murawski <markm at intellasoft.net>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: N A <asterisk at phreaknet.org>
Gerrit-Reviewer: Sean Bright <sean at seanbright.com>
Gerrit-CC: George Joseph <gjoseph at digium.com>
Gerrit-Attention: N A <asterisk at phreaknet.org>
Gerrit-Comment-Date: Sat, 14 Jan 2023 21:04:32 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: N A <asterisk at phreaknet.org>
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20230114/6094b7cc/attachment-0001.html>


More information about the asterisk-code-review mailing list