From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1751) id 01693385DC1B; Sun, 26 Apr 2020 14:14:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 01693385DC1B Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Philippe Waroquiers To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Fix comments and whitespace in lookup_cmd_composition X-Act-Checkin: binutils-gdb X-Git-Author: Philippe Waroquiers X-Git-Refname: refs/heads/master X-Git-Oldrev: a09f656b267b9a684f038fba7cadfe98e2f18892 X-Git-Newrev: bc3609fd3891c1cc0007eccd74bca98aabc03996 Message-Id: <20200426141454.01693385DC1B@sourceware.org> Date: Sun, 26 Apr 2020 14:14:54 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Apr 2020 14:14:54 -0000 https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=bc3609fd3891c1cc0007eccd74bca98aabc03996 commit bc3609fd3891c1cc0007eccd74bca98aabc03996 Author: Philippe Waroquiers Date: Sun Apr 26 16:01:52 2020 +0200 Fix comments and whitespace in lookup_cmd_composition 2020-04-26 Philippe Waroquiers * cli/cli-decode.c (lookup_cmd_composition): Fix comments and whitespace. Diff: --- gdb/ChangeLog | 5 +++++ gdb/cli/cli-decode.c | 58 ++++++++++++++++++++++++++-------------------------- 2 files changed, 34 insertions(+), 29 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ba0f680f974..8186fef88e3 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2020-04-26 Philippe Waroquiers + + * cli/cli-decode.c (lookup_cmd_composition): Fix comments + and whitespace. + 2020-04-25 Kamil Rytarowski * inf-ptrace.c (inf_ptrace_target::wait): Remove diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index 17f49ec80e4..d951ead1c95 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -1812,25 +1812,25 @@ deprecated_cmd_warning (const char *text) } -/* Look up the contents of LINE as a command in the command list 'cmdlist'. +/* Look up the contents of TEXT as a command in the command list 'cmdlist'. Return 1 on success, 0 on failure. - - If LINE refers to an alias, *alias will point to that alias. - - If LINE is a postfix command (i.e. one that is preceded by a prefix - command) set *prefix_cmd. - - Set *cmd to point to the command LINE indicates. - - If any of *alias, *prefix_cmd, or *cmd cannot be determined or do not + + If TEXT refers to an alias, *ALIAS will point to that alias. + + If TEXT is a subcommand (i.e. one that is preceded by a prefix + command) set *PREFIX_CMD. + + Set *CMD to point to the command TEXT indicates. + + If any of *ALIAS, *PREFIX_CMD, or *CMD cannot be determined or do not exist, they are NULL when we return. - + */ int lookup_cmd_composition (const char *text, - struct cmd_list_element **alias, - struct cmd_list_element **prefix_cmd, - struct cmd_list_element **cmd) + struct cmd_list_element **alias, + struct cmd_list_element **prefix_cmd, + struct cmd_list_element **cmd) { char *command; int len, nfound; @@ -1840,43 +1840,43 @@ lookup_cmd_composition (const char *text, *alias = NULL; *prefix_cmd = NULL; *cmd = NULL; - + cur_list = cmdlist; - + while (1) - { + { /* Go through as many command lists as we need to, to find the command TEXT refers to. */ - + prev_cmd = *cmd; - + while (*text == ' ' || *text == '\t') (text)++; - + /* Identify the name of the command. */ len = find_command_name_length (text); - + /* If nothing but whitespace, return. */ if (len == 0) return 0; - - /* Text is the start of the first command word to lookup (and + + /* TEXT is the start of the first command word to lookup (and it's length is len). We copy this into a local temporary. */ - + command = (char *) alloca (len + 1); memcpy (command, text, len); command[len] = '\0'; - + /* Look it up. */ *cmd = 0; nfound = 0; *cmd = find_cmd (command, len, cur_list, 1, &nfound); - + if (*cmd == CMD_LIST_AMBIGUOUS) { return 0; /* ambiguous */ } - + if (*cmd == NULL) return 0; /* nothing found */ else @@ -1884,7 +1884,7 @@ lookup_cmd_composition (const char *text, if ((*cmd)->cmd_pointer) { /* cmd was actually an alias, we note that an alias was - used (by assigning *alais) and we set *cmd. */ + used (by assigning *ALIAS) and we set *CMD. */ *alias = *cmd; *cmd = (*cmd)->cmd_pointer; } @@ -1894,7 +1894,7 @@ lookup_cmd_composition (const char *text, cur_list = *(*cmd)->prefixlist; else return 1; - + text += len; } }