<p>Corey Farrell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/8534">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">astobj2_container: Use ast_cli_completion_add for container names.<br><br>Change-Id: I4f0fc09e820eb8d8da2354a177dbcf503c56ddd1<br>---<br>M main/astobj2_container.c<br>1 file changed, 11 insertions(+), 18 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/34/8534/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/astobj2_container.c b/main/astobj2_container.c<br>index ae647d2..9bea58f 100644<br>--- a/main/astobj2_container.c<br>+++ b/main/astobj2_container.c<br>@@ -935,12 +935,15 @@<br> }<br> <br> #if defined(AO2_DEBUG)<br>-static int ao2_complete_reg_cb(void *obj, void *arg, void *data, int flags)<br>+static int ao2_complete_reg_cb(void *obj, void *arg, int flags)<br> {<br>-  struct ao2_reg_match *which = data;<br>+  struct ao2_reg_container *reg = obj;<br> <br>-      /* ao2_reg_sort_cb() has already filtered the search to matching keys */<br>-     return (which->find_nth < ++which->count) ? (CMP_MATCH | CMP_STOP) : 0;<br>+     if (ast_cli_completion_add(ast_strdup(reg->name))) {<br>+              return CMP_STOP;<br>+     }<br>+<br>+ return 0;<br> }<br> #endif  /* defined(AO2_DEBUG) */<br> <br>@@ -948,9 +951,6 @@<br> static char *complete_container_names(struct ast_cli_args *a)<br> {<br>  struct ao2_reg_partial_key partial_key;<br>-      struct ao2_reg_match which;<br>-  struct ao2_reg_container *reg;<br>-       char *name;<br> <br>        if (a->pos != 3) {<br>                 return NULL;<br>@@ -958,17 +958,10 @@<br> <br>        partial_key.len = strlen(a->word);<br>         partial_key.name = a->word;<br>-       which.find_nth = a->n;<br>-    which.count = 0;<br>-     reg = ao2_t_callback_data(reg_containers, partial_key.len ? OBJ_SEARCH_PARTIAL_KEY : 0,<br>-              ao2_complete_reg_cb, &partial_key, &which, "Find partial registered container");<br>-   if (reg) {<br>-           name = ast_strdup(reg->name);<br>-             ao2_t_ref(reg, -1, "Done with registered container object.");<br>-      } else {<br>-             name = NULL;<br>- }<br>-    return name;<br>+ ao2_callback(reg_containers, partial_key.len ? OBJ_SEARCH_PARTIAL_KEY : 0,<br>+           ao2_complete_reg_cb, &partial_key);<br>+<br>+   return NULL;<br> }<br> #endif       /* defined(AO2_DEBUG) */<br> <br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/8534">change 8534</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/8534"/><meta itemprop="name" content="View Change"/></div></div>

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