<p>Corey Farrell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/8640">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/40/8640/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/indications.c b/main/indications.c<br>index 8ca1068..13e968f 100644<br>--- a/main/indications.c<br>+++ b/main/indications.c<br>@@ -648,9 +648,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>@@ -658,17 +656,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>@@ -734,17 +732,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>@@ -752,16 +750,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/8640">change 8640</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/8640"/><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: I371be01f178fb542a9fbe8d97e7ae21aa4d82c36 </div>
<div style="display:none"> Gerrit-Change-Number: 8640 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>