<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/7495">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Corey Farrell: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Jenkins2: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pjsip: Improve CLI completion performance<br><br>Use the new ast_cli_completion_add() function to improve completion<br>performance for commands like 'pjsip show endpoint.'<br><br>Change-Id: I76d802294d2ac1766110dc75f7d117c8541ce348<br>---<br>M res/res_pjsip/pjsip_cli.c<br>1 file changed, 8 insertions(+), 16 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/res/res_pjsip/pjsip_cli.c b/res/res_pjsip/pjsip_cli.c<br>index 56ec191..4544a17 100644<br>--- a/res/res_pjsip/pjsip_cli.c<br>+++ b/res/res_pjsip/pjsip_cli.c<br>@@ -82,31 +82,22 @@<br> return 0;<br> }<br> <br>-static char *complete_show_sorcery_object(struct ao2_container *container,<br>+static void complete_show_sorcery_object(struct ao2_container *container,<br> struct ast_sip_cli_formatter_entry *formatter_entry,<br>- const char *word, int state)<br>+ const char *word)<br> {<br>- char *result = NULL;<br>- int wordlen = strlen(word);<br>- int which = 0;<br>-<br>- struct ao2_iterator i = ao2_iterator_init(container, 0);<br>+ size_t wordlen = strlen(word);<br> void *object;<br>+ struct ao2_iterator i = ao2_iterator_init(container, 0);<br> <br> while ((object = ao2_t_iterator_next(&i, "iterate thru endpoints table"))) {<br> const char *id = formatter_entry->get_id(object);<br>- if (!strncasecmp(word, id, wordlen)<br>- && ++which > state) {<br>- result = ast_strdup(id);<br>+ if (!strncasecmp(word, id, wordlen)) {<br>+ ast_cli_completion_add(ast_strdup(id));<br> }<br> ao2_t_ref(object, -1, "toss iterator endpoint ptr before break");<br>- if (result) {<br>- break;<br>- }<br> }<br> ao2_iterator_destroy(&i);<br>-<br>- return result;<br> }<br> <br> static void dump_str_and_free(int fd, struct ast_str *buf)<br>@@ -211,7 +202,8 @@<br> <br> if (cmd == CLI_GENERATE) {<br> ast_free(context.output_buffer);<br>- return complete_show_sorcery_object(container, formatter_entry, a->word, a->n);<br>+ complete_show_sorcery_object(container, formatter_entry, a->word);<br>+ return NULL;<br> }<br> <br> if (is_container) {<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7495">change 7495</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/7495"/><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: merged </div>
<div style="display:none"> Gerrit-Change-Id: I76d802294d2ac1766110dc75f7d117c8541ce348 </div>
<div style="display:none"> Gerrit-Change-Number: 7495 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean.bright@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: 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>