[Asterisk-code-review] res_stasis: Add ability to switch applications. (...asterisk[13])

Kevin Harwell asteriskteam at digium.com
Wed Mar 6 10:42:13 CST 2019


Kevin Harwell has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/10937 )

Change subject: res_stasis: Add ability to switch applications.
......................................................................


Patch Set 13:

(1 comment)

https://gerrit.asterisk.org/#/c/10937/13/res/stasis/control.c 
File res/stasis/control.c:

https://gerrit.asterisk.org/#/c/10937/13/res/stasis/control.c@528 
PS13, Line 528: 	AST_VECTOR_INIT(&move_data->args, 0);
              : 
              : 	if (app_args) {
              : 		char *iter = ast_strdupa(app_args);
              : 
              : 		if (!iter) {
              : 			move_free(move_data);
              : 			return -1;
              : 		}
              : 
              : 		token = strtok(iter, ",");
              : 		while (token != NULL) {
              : 			int res;
              : 			char *arg;
              : 
              : 			if (!(arg = ast_strdup(token))) {
              : 				move_free(move_data);
              : 				return -1;
              : 			}
              : 
              : 			res = AST_VECTOR_APPEND(&move_data->args, arg);
              : 			if (res) {
              : 				move_free(move_data);
              : 				return -1;
              : 			}
              : 
              : 			token = strtok(NULL, ",");
              : 		}
              : 	}
> In this case, you wouldn't need the custom destructor anymore either, would you? Since you wouldn't  […]
You would still need to dupe the name and args, and then free them if allocated. Knowing the size of both you could put them in the zero length array at the end of the struct if you wanted and that would remove the need for the custom destructor, and could just use ast_free_ptr.

Alternatively if name and args have a max size then you could declare an array of those sizes and copy the strings into them and again just use ast_free_ptr.



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

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I43d12b10045a98a8d42541889b85695be26f288a
Gerrit-Change-Number: 10937
Gerrit-PatchSet: 13
Gerrit-Owner: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Comment-Date: Wed, 06 Mar 2019 16:42:13 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Benjamin Keith Ford <bford at digium.com>
Comment-In-Reply-To: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190306/6f7389ae/attachment.html>


More information about the asterisk-code-review mailing list