<p>Corey Farrell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/8639">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">main/indications: Use ast_cli_completion_add for all completions.<br><br>Change-Id: I371be01f178fb542a9fbe8d97e7ae21aa4d82c36<br>---<br>M main/indications.c<br>1 file changed, 16 insertions(+), 17 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/39/8639/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/indications.c b/main/indications.c<br>index 8971058..55fac71 100644<br>--- a/main/indications.c<br>+++ b/main/indications.c<br>@@ -632,9 +632,7 @@<br> <br> static char *complete_country(struct ast_cli_args *a)<br> {<br>-        char *res = NULL;<br>     struct ao2_iterator i;<br>-       int which = 0;<br>        size_t wordlen;<br>       struct ast_tone_zone *tz;<br> <br>@@ -642,17 +640,17 @@<br> <br>        i = ao2_iterator_init(ast_tone_zones, 0);<br>     while ((tz = ao2_iterator_next(&i))) {<br>-           if (!strncasecmp(a->word, tz->country, wordlen) && ++which > a->n) {<br>-                     res = ast_strdup(tz->country);<br>+            if (!strncasecmp(a->word, tz->country, wordlen)) {<br>+                     if (ast_cli_completion_add(ast_strdup(tz->country))) {<br>+                            ast_tone_zone_unref(tz);<br>+                             break;<br>+                       }<br>             }<br>-            tz = ast_tone_zone_unref(tz);<br>-                if (res) {<br>-                   break;<br>-               }<br>+            ast_tone_zone_unref(tz);<br>      }<br>     ao2_iterator_destroy(&i);<br> <br>-     return res;<br>+  return NULL;<br> }<br> <br> static char *handle_cli_indication_add(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)<br>@@ -718,17 +716,17 @@<br> <br> static char *complete_indications(struct ast_cli_args *a)<br> {<br>-     char *res = NULL;<br>-    int which = 0;<br>        size_t wordlen;<br>       struct ast_tone_zone_sound *ts;<br>-      struct ast_tone_zone *tz, tmp_tz = {<br>+ struct ast_tone_zone *tz;<br>+    struct ast_tone_zone tmp_tz = {<br>               .nrringcadence = 0,<br>   };<br> <br>         ast_copy_string(tmp_tz.country, a->argv[a->pos - 1], sizeof(tmp_tz.country));<br> <br>-       if (!(tz = ao2_find(ast_tone_zones, &tmp_tz, OBJ_POINTER))) {<br>+    tz = ao2_find(ast_tone_zones, &tmp_tz, OBJ_POINTER);<br>+     if (!tz) {<br>            return NULL;<br>  }<br> <br>@@ -736,16 +734,17 @@<br> <br>        ast_tone_zone_lock(tz);<br>       AST_LIST_TRAVERSE(&tz->tones, ts, entry) {<br>-            if (!strncasecmp(a->word, ts->name, wordlen) && ++which > a->n) {<br>-                        res = ast_strdup(ts->name);<br>-                       break;<br>+               if (!strncasecmp(a->word, ts->name, wordlen)) {<br>+                        if (ast_cli_completion_add(ast_strdup(ts->name))) {<br>+                               break;<br>+                       }<br>             }<br>     }<br>     ast_tone_zone_unlock(tz);<br> <br>  tz = ast_tone_zone_unref(tz);<br> <br>-     return res;<br>+  return NULL;<br> }<br> <br> static char *handle_cli_indication_remove(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/8639">change 8639</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/8639"/><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: I371be01f178fb542a9fbe8d97e7ae21aa4d82c36 </div>
<div style="display:none"> Gerrit-Change-Number: 8639 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>