[Asterisk-code-review] func_channel: Added new OTHER_CHANNEL function (asterisk[16])

Richard Mudgett asteriskteam at digium.com
Mon May 17 09:58:50 CDT 2021


Richard Mudgett has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/15908 )

Change subject: func_channel: Added new OTHER_CHANNEL function
......................................................................


Patch Set 1: Code-Review-1

(6 comments)

https://gerrit.asterisk.org/c/asterisk/+/15908/1/funcs/func_channel.c 
File funcs/func_channel.c:

https://gerrit.asterisk.org/c/asterisk/+/15908/1/funcs/func_channel.c@771 
PS1, Line 771: 	char *template = ast_alloca(4 + strlen(data));
Please do not use C++ keywords


https://gerrit.asterisk.org/c/asterisk/+/15908/1/funcs/func_channel.c@772 
PS1, Line 772: 	
red blob


https://gerrit.asterisk.org/c/asterisk/+/15908/1/funcs/func_channel.c@783 
PS1, Line 783: 	if (!(ochan = ast_channel_get_by_name(args.channel))) {
It is clearer to not assign within the if expression.  The compiler should be generating the same code and you do not have to use extra parentheses to suppress a compiler warning.

ochan = ast_channel_...();
if (!ochan) {
}


https://gerrit.asterisk.org/c/asterisk/+/15908/1/funcs/func_channel.c@792 
PS1, Line 792: 	sprintf(template, "${%s}", data); /* SAFE */
Use of snprintf is safer as far as compiler warnings.


https://gerrit.asterisk.org/c/asterisk/+/15908/1/funcs/func_channel.c@804 
PS1, Line 804: 	
red


https://gerrit.asterisk.org/c/asterisk/+/15908/1/funcs/func_channel.c@816 
PS1, Line 816: 		ast_log(LOG_ERROR, "Channel '%s' not found!  Variable '%s' will be blank.\n", args.channel, args.var);
I don't think this should be an error as it is quite possible for an arbitrary "other" channel to disappear at any time.



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

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I7492645ae4307553d0f586d78e13a4f586231fdf
Gerrit-Change-Number: 15908
Gerrit-PatchSet: 1
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-CC: Joshua Colp <jcolp at sangoma.com>
Gerrit-Comment-Date: Mon, 17 May 2021 14:58:50 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210517/88730db6/attachment.html>


More information about the asterisk-code-review mailing list