<p>Corey Farrell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/8601">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">main/translate: Use ast_cli_completion_add.<br><br>Change-Id: I0e2402660e54d91f74ab0804c62a5b1925577413<br>---<br>M main/translate.c<br>1 file changed, 10 insertions(+), 8 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/01/8601/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/translate.c b/main/translate.c<br>index 240e495..38f29fd 100644<br>--- a/main/translate.c<br>+++ b/main/translate.c<br>@@ -891,9 +891,9 @@<br>         return ast_str_buffer(*str);<br> }<br> <br>-static char *complete_trans_path_choice(const char *line, const char *word, int pos, int state)<br>+static char *complete_trans_path_choice(const char *word)<br> {<br>-        int i = 1, which = 0;<br>+        int i = 1;<br>    int wordlen = strlen(word);<br>   struct ast_codec *codec;<br> <br>@@ -903,13 +903,15 @@<br>                    ao2_ref(codec, -1);<br>                   continue;<br>             }<br>-            if (!strncasecmp(word, codec->name, wordlen) && ++which > state) {<br>-                     char *res = ast_strdup(codec->name);<br>-                      ao2_ref(codec, -1);<br>-                  return res;<br>+          if (!strncasecmp(word, codec->name, wordlen)) {<br>+                   if (ast_cli_completion_add(ast_strdup(codec->name))) {<br>+                            ao2_ref(codec, -1);<br>+                          break;<br>+                       }<br>             }<br>             ao2_ref(codec, -1);<br>   }<br>+<br>  return NULL;<br> }<br> <br>@@ -1129,10 +1131,10 @@<br>          return NULL;<br>  case CLI_GENERATE:<br>            if (a->pos == 3) {<br>-                        return ast_cli_complete(a->word, option, a->n);<br>+                        return ast_cli_complete(a->word, option, -1);<br>              }<br>             if (a->pos == 4 && !strcasecmp(a->argv[3], option[1])) {<br>-                       return complete_trans_path_choice(a->line, a->word, a->pos, a->n);<br>+                       return complete_trans_path_choice(a->word);<br>                }<br>             /* BUGBUG - add tab completion for sample rates */<br>            return NULL;<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/8601">change 8601</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/8601"/><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-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I0e2402660e54d91f74ab0804c62a5b1925577413 </div>
<div style="display:none"> Gerrit-Change-Number: 8601 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>