Skip to contentSkip to conversation

perf tools: Remove support for command aliases

tip:perf/core tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message Apr 2, 2017 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  c68677014bace6a4b6ad20f0818e1470d049618f
Gitweb:     http://git.kernel.org/tip/c68677014bace6a4b6ad20f0818e1470d049618f
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Tue, 28 Mar 2017 11:19:59 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 28 Mar 2017 11:19:59 -0300

perf tools: Remove support for command aliases

This came from 'git', but isn't documented anywhere in tools/perf/Documentation/, looks like baggage we can do without, ditch it.

---
 tools/perf/builtin-help.c          | 13 -----
 tools/perf/perf.c                  | 97 +++-----------------------------------
 tools/perf/util/Build              |  1 -
 tools/perf/util/alias.c            | 78 ------------------------------
 tools/perf/util/cache.h            |  1 -
 tools/perf/util/help-unknown-cmd.c |  8 +---
 6 files changed, 8 insertions(+), 190 deletions(-)
tools/perf/builtin-help.c +0 -13
index 7ae2389..1eec96a 100644
@@ -301,12 +301,6 @@ void list_common_cmds_help(void)
 	}
 }
 
-static int is_perf_command(const char *s)
-{
-	return is_in_cmdlist(&main_cmds, s) ||
-		is_in_cmdlist(&other_cmds, s);
-}
-
 static const char *cmd_to_page(const char *perf_cmd)
 {
 	char *s;
@@ -446,7 +440,6 @@ int cmd_help(int argc, const char **argv)
 		"perf help [--all] [--man|--web|--info] [command]",
 		NULL
 	};
-	const char *alias;
 	int rc;
 
 	load_command_list("perf-", &main_cmds, &other_cmds);
@@ -472,12 +465,6 @@ int cmd_help(int argc, const char **argv)
 		return 0;
 	}
 
-	alias = alias_lookup(argv[0]);
-	if (alias && !is_perf_command(argv[0])) {
-		printf("`perf %s' is aliased to `%s'\n", argv[0], alias);
-		return 0;
-	}
-
 	switch (help_format) {
 	case HELP_FORMAT_MAN:
 		rc = show_man_page(argv[0]);
tools/perf/perf.c +7 -90

120 lines not on this page · raw message

tools/perf/util/Build +0 -1
index 2ae92da..5c0ea11 100644
@@ -1,4 +1,3 @@
-libperf-y += alias.o
 libperf-y += annotate.o
 libperf-y += block-range.o
 libperf-y += build-id.o
tools/perf/util/alias.c deleted +0 -78

78 lines not on this page · raw message

tools/perf/util/cache.h +0 -1
index 512c0c8..0328f29 100644
@@ -15,7 +15,6 @@
 #define PERF_TRACEFS_ENVIRONMENT "PERF_TRACEFS_DIR"
 #define PERF_PAGER_ENVIRONMENT "PERF_PAGER"
 
-char *alias_lookup(const char *alias);
 int split_cmdline(char *cmdline, const char ***argv);
 
 #define alloc_nr(x) (((x)+16)*3/2)
tools/perf/util/help-unknown-cmd.c +1 -7
index 2821f8d..3420144 100644
@@ -6,16 +6,12 @@
 #include "levenshtein.h"
 
 static int autocorrect;
-static struct cmdnames aliases;
 
 static int perf_unknown_cmd_config(const char *var, const char *value,
 				   void *cb __maybe_unused)
 {
 	if (!strcmp(var, "help.autocorrect"))
 		autocorrect = perf_config_int(var,value);
-	/* Also use aliases for command lookup */
-	if (!prefixcmp(var, "alias."))
-		add_cmdname(&aliases, var + 6, strlen(var + 6));
 
 	return 0;
 }
@@ -59,14 +55,12 @@ const char *help_unknown_cmd(const char *cmd)
 
 	memset(&main_cmds, 0, sizeof(main_cmds));
 	memset(&other_cmds, 0, sizeof(main_cmds));
-	memset(&aliases, 0, sizeof(aliases));
 
 	perf_config(perf_unknown_cmd_config, NULL);
 
 	load_command_list("perf-", &main_cmds, &other_cmds);
 
-	if (add_cmd_list(&main_cmds, &aliases) < 0 ||
-	    add_cmd_list(&main_cmds, &other_cmds) < 0) {
+	if (add_cmd_list(&main_cmds, &other_cmds) < 0) {
 		fprintf(stderr, "ERROR: Failed to allocate command list for unknown command.\n");
 		goto end;
 	}