<p>Corey Farrell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/8536">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">main/ccss: Use ast_cli_completion_add for core id.<br><br>Change-Id: I44b25d6d24c7d9bc1bb38a50774b38883162f98f<br>---<br>M main/ccss.c<br>1 file changed, 8 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/36/8536/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/ccss.c b/main/ccss.c<br>index ed0bba7..fa569aa 100644<br>--- a/main/ccss.c<br>+++ b/main/ccss.c<br>@@ -4547,11 +4547,9 @@<br>         return 0;<br> }<br> <br>-static char *complete_core_id(const char *line, const char *word, int pos, int state)<br>+static char *complete_core_id(const char *word)<br> {<br>-       int which = 0;<br>        int wordlen = strlen(word);<br>-  char *ret = NULL;<br>     struct ao2_iterator core_iter = ao2_iterator_init(cc_core_instances, 0);<br>      struct cc_core_instance *core_instance;<br> <br>@@ -4559,15 +4557,16 @@<br>                   cc_unref(core_instance, "CLI tab completion iteration")) {<br>          char core_id_str[20];<br>                 snprintf(core_id_str, sizeof(core_id_str), "%d", core_instance->core_id);<br>-               if (!strncmp(word, core_id_str, wordlen) && ++which > state) {<br>-                    ret = ast_strdup(core_id_str);<br>-                       cc_unref(core_instance, "Found a matching core ID for CLI tab-completion");<br>-                        break;<br>+               if (!strncmp(word, core_id_str, wordlen)) {<br>+                  if (ast_cli_completion_add(ast_strdup(core_id_str))) {<br>+                               cc_unref(core_instance, "Found a matching core ID for CLI tab-completion");<br>+                                break;<br>+                       }<br>             }<br>     }<br>     ao2_iterator_destroy(&core_iter);<br> <br>-     return ret;<br>+  return NULL;<br> }<br> <br> static char *handle_cc_kill(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)<br>@@ -4583,7 +4582,7 @@<br>            return NULL;<br>  case CLI_GENERATE:<br>            if (a->pos == 3 && !strcasecmp(a->argv[2], "core")) {<br>-                        return complete_core_id(a->line, a->word, a->pos, a->n);<br>+                 return complete_core_id(a->word);<br>          }<br>             return NULL;<br>  }<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/8536">change 8536</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/8536"/><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: I44b25d6d24c7d9bc1bb38a50774b38883162f98f </div>
<div style="display:none"> Gerrit-Change-Number: 8536 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>