<p>Corey Farrell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/8583">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">main/sounds: Use ast_cli_completion_add.<br><br>Change-Id: I140e1137906bbfcdb61c0c6304159be459ad873e<br>---<br>M main/sounds.c<br>1 file changed, 9 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/83/8583/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/sounds.c b/main/sounds.c<br>index c792c1b..d0e5ff8 100644<br>--- a/main/sounds.c<br>+++ b/main/sounds.c<br>@@ -229,26 +229,27 @@<br> case CLI_GENERATE:<br> {<br> int length = strlen(a->word);<br>- int which = 0;<br> struct ao2_iterator it_sounds;<br>- char *match = NULL;<br> char *filename;<br>- RAII_VAR(struct ao2_container *, sound_files, ast_media_get_media(sounds_index), ao2_cleanup);<br>+ struct ao2_container *sound_files = ast_media_get_media(sounds_index);<br>+<br> if (!sound_files) {<br> return NULL;<br> }<br> <br> it_sounds = ao2_iterator_init(sound_files, 0);<br> while ((filename = ao2_iterator_next(&it_sounds))) {<br>- if (!strncasecmp(a->word, filename, length) && ++which > a->n) {<br>- match = ast_strdup(filename);<br>- ao2_ref(filename, -1);<br>- break;<br>+ if (!strncasecmp(a->word, filename, length)) {<br>+ if (ast_cli_completion_add(ast_strdup(filename))) {<br>+ ao2_ref(filename, -1);<br>+ break;<br>+ }<br> }<br> ao2_ref(filename, -1);<br> }<br> ao2_iterator_destroy(&it_sounds);<br>- return match;<br>+<br>+ return NULL;<br> }<br> }<br> <br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/8583">change 8583</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/8583"/><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: I140e1137906bbfcdb61c0c6304159be459ad873e </div>
<div style="display:none"> Gerrit-Change-Number: 8583 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>