<p><a href="https://gerrit.asterisk.org/c/asterisk/+/10937">View Change</a></p><p>1 comment:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.asterisk.org/#/c/10937/13/res/stasis/control.c">File res/stasis/control.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/10937/13/res/stasis/control.c@528">Patch Set #13, Line 528:</a> </p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><pre style="font-family: monospace,monospace; white-space: pre-wrap;">       AST_VECTOR_INIT(&move_data->args, 0);<br><br>        if (app_args) {<br>               char *iter = ast_strdupa(app_args);<br><br>         if (!iter) {<br>                  move_free(move_data);<br>                 return -1;<br>            }<br><br>           token = strtok(iter, ",");<br>          while (token != NULL) {<br>                       int res;<br>                      char *arg;<br><br>                  if (!(arg = ast_strdup(token))) {<br>                             move_free(move_data);<br>                         return -1;<br>                    }<br><br>                   res = AST_VECTOR_APPEND(&move_data->args, arg);<br>                        if (res) {<br>                            move_free(move_data);<br>                         return -1;<br>                    }<br><br>                   token = strtok(NULL, ",");<br>          }<br>     }<br></pre></blockquote></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">In this case, you wouldn't need the custom destructor anymore either, would you? Since you wouldn't  […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">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.</p><p style="white-space: pre-wrap; word-wrap: break-word;">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.</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/10937">change 10937</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/10937"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-Change-Id: I43d12b10045a98a8d42541889b85695be26f288a </div>
<div style="display:none"> Gerrit-Change-Number: 10937 </div>
<div style="display:none"> Gerrit-PatchSet: 13 </div>
<div style="display:none"> Gerrit-Owner: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Wed, 06 Mar 2019 16:42:13 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-Has-Labels: No </div>
<div style="display:none"> Comment-In-Reply-To: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Comment-In-Reply-To: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: comment </div>