[Asterisk-code-review] main/channel: Use ast cli completion add for channeltypes. (asterisk[13])
George Joseph
asteriskteam at digium.com
Fri Mar 16 10:35:01 CDT 2018
George Joseph has submitted this change and it was merged. ( https://gerrit.asterisk.org/8532 )
Change subject: main/channel: Use ast_cli_completion_add for channeltypes.
......................................................................
main/channel: Use ast_cli_completion_add for channeltypes.
Change-Id: Ia845fae6a84801cc7d9996767b99efb2753cbb48
---
M main/channel.c
1 file changed, 5 insertions(+), 7 deletions(-)
Approvals:
George Joseph: Looks good to me, but someone else must approve; Approved for Submit
Kevin Harwell: Looks good to me, approved
diff --git a/main/channel.c b/main/channel.c
index 70e0bff..72e7d4a 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -314,25 +314,23 @@
static char *complete_channeltypes(struct ast_cli_args *a)
{
struct chanlist *cl;
- int which = 0;
int wordlen;
- char *ret = NULL;
- if (a->pos != 3)
+ if (a->pos != 3) {
return NULL;
+ }
wordlen = strlen(a->word);
AST_RWLIST_RDLOCK(&backends);
AST_RWLIST_TRAVERSE(&backends, cl, list) {
- if (!strncasecmp(a->word, cl->tech->type, wordlen) && ++which > a->n) {
- ret = ast_strdup(cl->tech->type);
- break;
+ if (!strncasecmp(a->word, cl->tech->type, wordlen)) {
+ ast_cli_completion_add(ast_strdup(cl->tech->type));
}
}
AST_RWLIST_UNLOCK(&backends);
- return ret;
+ return NULL;
}
/*! \brief Show details about a channel driver - CLI command */
--
To view, visit https://gerrit.asterisk.org/8532
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia845fae6a84801cc7d9996767b99efb2753cbb48
Gerrit-Change-Number: 8532
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180316/32295067/attachment-0001.html>
More information about the asterisk-code-review
mailing list