[Asterisk-code-review] main/cdr: Use ast cli completion add for CDR channel complet... (asterisk[13])

Jenkins2 asteriskteam at digium.com
Mon Mar 19 09:05:33 CDT 2018


Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/8543 )

Change subject: main/cdr: Use ast_cli_completion_add for CDR channel completion.
......................................................................

main/cdr: Use ast_cli_completion_add for CDR channel completion.

Change-Id: Ie81830647a23aad61c1162583b6d50adbe6e7822
---
M main/cdr.c
1 file changed, 4 insertions(+), 7 deletions(-)

Approvals:
  George Joseph: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved
  Jenkins2: Approved for Submit



diff --git a/main/cdr.c b/main/cdr.c
index 3e02c3e..496fb36 100644
--- a/main/cdr.c
+++ b/main/cdr.c
@@ -3920,18 +3920,14 @@
 /*! \brief Complete user input for 'cdr show' */
 static char *cli_complete_show(struct ast_cli_args *a)
 {
-	char *result = NULL;
 	int wordlen = strlen(a->word);
-	int which = 0;
 	struct ao2_iterator it_cdrs;
 	struct cdr_object *cdr;
 
 	it_cdrs = ao2_iterator_init(active_cdrs_master, 0);
 	while ((cdr = ao2_iterator_next(&it_cdrs))) {
-		if (!strncasecmp(a->word, cdr->party_a.snapshot->name, wordlen) &&
-			(++which > a->n)) {
-			result = ast_strdup(cdr->party_a.snapshot->name);
-			if (result) {
+		if (!strncasecmp(a->word, cdr->party_a.snapshot->name, wordlen)) {
+			if (ast_cli_completion_add(ast_strdup(cdr->party_a.snapshot->name))) {
 				ao2_ref(cdr, -1);
 				break;
 			}
@@ -3939,7 +3935,8 @@
 		ao2_ref(cdr, -1);
 	}
 	ao2_iterator_destroy(&it_cdrs);
-	return result;
+
+	return NULL;
 }
 
 static void cli_show_channels(struct ast_cli_args *a)

-- 
To view, visit https://gerrit.asterisk.org/8543
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie81830647a23aad61c1162583b6d50adbe6e7822
Gerrit-Change-Number: 8543
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
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/20180319/3fe722d3/attachment-0001.html>


More information about the asterisk-code-review mailing list