<p>Corey Farrell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/8593">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">named_acl: Use ast_cli_completion_add.<br><br>Change-Id: I317a82de976bbdbfe4352c243e32a7bb8f66c377<br>---<br>M main/named_acl.c<br>1 file changed, 9 insertions(+), 9 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/93/8593/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/named_acl.c b/main/named_acl.c<br>index 3a4c454..af1a8a2 100644<br>--- a/main/named_acl.c<br>+++ b/main/named_acl.c<br>@@ -500,12 +500,10 @@<br> /* \brief ACL command show <name> */<br> static char *handle_show_named_acl_cmd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)<br> {<br>-        RAII_VAR(struct named_acl_config *, cfg, ao2_global_obj_ref(globals), ao2_cleanup);<br>+  struct named_acl_config *cfg;<br>         int length;<br>-  int which;<br>    struct ao2_iterator i;<br>        struct named_acl *named_acl;<br>- char *match = NULL;<br> <br>        switch (cmd) {<br>        case CLI_INIT:<br>@@ -515,23 +513,25 @@<br>                         "   Shows a list of named ACLs or lists all entries in a given named ACL.\n";<br>               return NULL;<br>  case CLI_GENERATE:<br>+           cfg = ao2_global_obj_ref(globals);<br>            if (!cfg) {<br>                   return NULL;<br>          }<br>             length = strlen(a->word);<br>-         which = 0;<br>            i = ao2_iterator_init(cfg->named_acl_list, 0);<br>             while ((named_acl = ao2_iterator_next(&i))) {<br>-                    if (!strncasecmp(a->word, named_acl->name, length) && ++which > a->n) {<br>-                          match = ast_strdup(named_acl->name);<br>-                              ao2_ref(named_acl, -1);<br>-                              break;<br>+                       if (!strncasecmp(a->word, named_acl->name, length)) {<br>+                          if (ast_cli_completion_add(ast_strdup(named_acl->name))) {<br>+                                        ao2_ref(named_acl, -1);<br>+                                      break;<br>+                               }<br>                     }<br>                     ao2_ref(named_acl, -1);<br>               }<br>             ao2_iterator_destroy(&i);<br>-                return match;<br>+                ao2_ref(cfg, -1);<br> <br>+         return NULL;<br>  }<br> <br>  if (a->argc == 2) {<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/8593">change 8593</a>. To unsubscribe, 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/8593"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I317a82de976bbdbfe4352c243e32a7bb8f66c377 </div>
<div style="display:none"> Gerrit-Change-Number: 8593 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>