<p>Joshua Colp <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/8600">View Change</a></p><div style="white-space:pre-wrap">Approvals:
George Joseph: Looks good to me, but someone else must approve
Richard Mudgett: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, approved; Approved for Submit
</div><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;">diff --git a/main/translate.c b/main/translate.c<br>index 226d098..396c552 100644<br>--- a/main/translate.c<br>+++ b/main/translate.c<br>@@ -900,9 +900,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>@@ -912,13 +912,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>@@ -1138,10 +1140,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/8600">change 8600</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/8600"/><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: merged </div>
<div style="display:none"> Gerrit-Change-Id: I0e2402660e54d91f74ab0804c62a5b1925577413 </div>
<div style="display:none"> Gerrit-Change-Number: 8600 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>