From: Corey Farrell Date: Sat, 17 Mar 2018 07:00:45 +0000 (-0400) Subject: main/taskprocessor: Use ast_cli_completion_add. X-Git-Tag: 13.21.0-rc1~49^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d202b56a7438f3c105956340b31c4baa135adaad;p=thirdparty%2Fasterisk.git main/taskprocessor: Use ast_cli_completion_add. Change-Id: Ie5f812a988ed811fd11967151932de62bc131b48 --- diff --git a/main/taskprocessor.c b/main/taskprocessor.c index a464adac9e..7577715e65 100644 --- a/main/taskprocessor.c +++ b/main/taskprocessor.c @@ -343,26 +343,27 @@ static void *tps_task_free(struct tps_task *task) static char *tps_taskprocessor_tab_complete(struct ast_cli_args *a) { int tklen; - int wordnum = 0; struct ast_taskprocessor *p; - char *name = NULL; struct ao2_iterator i; - if (a->pos != 3) + if (a->pos != 3) { return NULL; + } tklen = strlen(a->word); i = ao2_iterator_init(tps_singletons, 0); while ((p = ao2_iterator_next(&i))) { - if (!strncasecmp(a->word, p->name, tklen) && ++wordnum > a->n) { - name = ast_strdup(p->name); - ast_taskprocessor_unreference(p); - break; + if (!strncasecmp(a->word, p->name, tklen)) { + if (ast_cli_completion_add(ast_strdup(p->name))) { + ast_taskprocessor_unreference(p); + break; + } } ast_taskprocessor_unreference(p); } ao2_iterator_destroy(&i); - return name; + + return NULL; } /* ping task handling function */