[Asterisk-code-review] CLI: Remove compatibility code. (asterisk[master])

Jenkins2 asteriskteam at digium.com
Tue Nov 28 12:50:29 CST 2017


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

Change subject: CLI: Remove compatibility code.
......................................................................

CLI: Remove compatibility code.

Previous commits maintained compatibility with older remote console
clients as well as maintaining all API's.

Remove the following compatibility code:
* ast_cli_generatornummatches.
* Remote command "_command nummatches".
* Sorting / duplicate removal by remote console.

Change-Id: I59e6ce94fa57ae564888442049695f7e46746437
---
M include/asterisk/cli.h
M main/asterisk.c
M main/cli.c
3 files changed, 1 insertion(+), 54 deletions(-)

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



diff --git a/include/asterisk/cli.h b/include/asterisk/cli.h
index c75fc29..30c5dc7 100644
--- a/include/asterisk/cli.h
+++ b/include/asterisk/cli.h
@@ -293,8 +293,6 @@
  */
 char *ast_cli_generator(const char *, const char *, int);
 
-int ast_cli_generatornummatches(const char *, const char *);
-
 /*!
  * \brief Generates a NULL-terminated array of strings that
  * 1) begin with the string in the second parameter, and
diff --git a/main/asterisk.c b/main/asterisk.c
index db80670..dd66867 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -3015,14 +3015,8 @@
 			break;
 		}
 
-		/* Older daemons sent duplicates. */
-		if (AST_VECTOR_GET_CMP(vec, retstr, strcasecmp)) {
-			continue;
-		}
-
 		retstr = ast_strdup(retstr);
-		/* Older daemons sent unsorted. */
-		if (!retstr || AST_VECTOR_ADD_SORTED(vec, retstr, strcasecmp)) {
+		if (!retstr || AST_VECTOR_APPEND(vec, retstr)) {
 			ast_free(retstr);
 			goto vector_cleanup;
 		}
diff --git a/main/cli.c b/main/cli.c
index 0f023b2..75846b8 100644
--- a/main/cli.c
+++ b/main/cli.c
@@ -1336,33 +1336,6 @@
 }
 
 
-
-static char *handle_commandnummatches(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
-{
-	int matches = 0;
-
-	switch (cmd) {
-	case CLI_INIT:
-		e->command = "_command nummatches";
-		e->usage =
-			"Usage: _command nummatches \"<line>\" text \n"
-			"       This function is used internally to help with command completion and should.\n"
-			"       never be called by the user directly.\n";
-		return NULL;
-	case CLI_GENERATE:
-		return NULL;
-	}
-
-	if (a->argc != 4)
-		return CLI_SHOWUSAGE;
-
-	matches = ast_cli_generatornummatches(a->argv[2], a->argv[3]);
-
-	ast_cli(a->fd, "%d", matches);
-
-	return CLI_SUCCESS;
-}
-
 struct channel_set_debug_args {
 	int fd;
 	int is_off;
@@ -1794,7 +1767,6 @@
 static char *handle_help(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
 
 static struct ast_cli_entry cli_cli[] = {
-	AST_CLI_DEFINE(handle_commandnummatches, "Returns number of command matches"),
 	AST_CLI_DEFINE(handle_commandmatchesarray, "Returns command matches array"),
 
 	AST_CLI_DEFINE(handle_nodebugchan_deprecated, "Disable debugging on channel(s)"),
@@ -2470,23 +2442,6 @@
 	*argc = x;
 	*trailingwhitespace = whitespace;
 	return duplicate;
-}
-
-/*! \brief Return the number of unique matches for the generator */
-int ast_cli_generatornummatches(const char *text, const char *word)
-{
-	int matches;
-	struct ast_vector_string *vec = ast_cli_completion_vector(text, word);
-
-	if (!vec) {
-		return 0;
-	}
-
-	matches = AST_VECTOR_SIZE(vec) - 1;
-	AST_VECTOR_CALLBACK_VOID(vec, ast_free);
-	AST_VECTOR_PTR_FREE(vec);
-
-	return matches;
 }
 
 char **ast_cli_completion_matches(const char *text, const char *word)

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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I59e6ce94fa57ae564888442049695f7e46746437
Gerrit-Change-Number: 7335
Gerrit-PatchSet: 4
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: 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/20171128/89b80682/attachment.html>


More information about the asterisk-code-review mailing list