From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17371 invoked by alias); 11 Mar 2011 21:04:48 -0000 Received: (qmail 17363 invoked by uid 22791); 11 Mar 2011 21:04:47 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SHORT_BODY,TW_WC,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-outbound-1.vmware.com (HELO smtp-outbound-1.vmware.com) (65.115.85.69) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 11 Mar 2011 21:04:43 +0000 Received: from mailhost3.vmware.com (mailhost3.vmware.com [10.16.27.45]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id 04C7F17013; Fri, 11 Mar 2011 13:04:42 -0800 (PST) Received: from msnyder-server.eng.vmware.com (promd-2s-dhcp138.eng.vmware.com [10.20.124.138]) by mailhost3.vmware.com (Postfix) with ESMTP id F1508CD97F; Fri, 11 Mar 2011 13:04:41 -0800 (PST) Message-ID: <4D7A8E69.9020104@vmware.com> Date: Fri, 11 Mar 2011 21:29:00 -0000 From: Michael Snyder User-Agent: Thunderbird 2.0.0.24 (X11/20110128) MIME-Version: 1.0 To: "gdb-patches@sourceware.org" , Joel Brobecker Subject: [RFA] Add constant CMD_LIST_AMBIGUOUS to replace (struct cmd_list_element *) -1 Content-Type: multipart/mixed; boundary="------------070500010001000802090901" X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-03/txt/msg00673.txt.bz2 This is a multi-part message in MIME format. --------------070500010001000802090901 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 5 OK? --------------070500010001000802090901 Content-Type: text/plain; name="ambiguous.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ambiguous.txt" Content-length: 3853 2011-03-11 Michael Snyder * cli/cli-decode.h (CMD_LIST_AMBIGUOUS): Define. * cli/cli-decode.c (lookup_cmd_1): Use CMD_LIST_AMBIGUOUS. (lookup_cmd): Test for CMD_LIST_AMBIGUOUS. * completer.c (complete_line_internal): Use CMD_LIST_AMBIGUOUS. * top.c (set_verbose): Use CMD_LIST_AMBIGUOUS. Index: completer.c =================================================================== RCS file: /cvs/src/src/gdb/completer.c,v retrieving revision 1.44 diff -u -p -r1.44 completer.c --- completer.c 26 Feb 2011 02:07:07 -0000 1.44 +++ completer.c 11 Mar 2011 20:55:25 -0000 @@ -590,7 +590,7 @@ complete_line_internal (const char *text { /* An empty line we want to consider ambiguous; that is, it could be any command. */ - c = (struct cmd_list_element *) -1; + c = CMD_LIST_AMBIGUOUS; result_list = 0; } else @@ -610,7 +610,7 @@ complete_line_internal (const char *text possible completions. */ list = NULL; } - else if (c == (struct cmd_list_element *) -1) + else if (c == CMD_LIST_AMBIGUOUS) { char *q; Index: top.c =================================================================== RCS file: /cvs/src/src/gdb/top.c,v retrieving revision 1.194 diff -u -p -r1.194 top.c --- top.c 11 Mar 2011 20:38:57 -0000 1.194 +++ top.c 11 Mar 2011 20:55:25 -0000 @@ -1425,8 +1425,7 @@ set_verbose (char *args, int from_tty, s struct cmd_list_element *showcmd; showcmd = lookup_cmd_1 (&cmdname, showlist, NULL, 1); - gdb_assert (showcmd != NULL - && showcmd != (struct cmd_list_element *) -1); + gdb_assert (showcmd != NULL && showcmd != CMD_LIST_AMBIGUOUS); if (info_verbose) { Index: cli/cli-decode.c =================================================================== RCS file: /cvs/src/src/gdb/cli/cli-decode.c,v retrieving revision 1.92 diff -u -p -r1.92 cli-decode.c --- cli/cli-decode.c 6 Jan 2011 00:57:02 -0000 1.92 +++ cli/cli-decode.c 11 Mar 2011 20:55:25 -0000 @@ -1228,7 +1228,7 @@ lookup_cmd_1 (char **text, struct cmd_li /* Will be modified in calling routine if we know what the prefix command is. */ *result_list = 0; - return (struct cmd_list_element *) -1; /* Ambiguous. */ + return CMD_LIST_AMBIGUOUS; /* Ambiguous. */ } /* We've matched something on this list. Move text pointer forward. */ @@ -1261,7 +1261,7 @@ lookup_cmd_1 (char **text, struct cmd_li *result_list = clist; return found; } - else if (c == (struct cmd_list_element *) -1) + else if (c == CMD_LIST_AMBIGUOUS) { /* We've gotten this far properly, but the next step is ambiguous. We need to set the result list to the best @@ -1346,7 +1346,7 @@ lookup_cmd (char **line, struct cmd_list else return 0; } - else if (c == (struct cmd_list_element *) -1) + else if (c == CMD_LIST_AMBIGUOUS) { /* Ambigous. Local values should be off prefixlist or called values. */ @@ -1569,7 +1569,7 @@ lookup_cmd_composition (char *text, *cmd = find_cmd (command, len, cur_list, 1, &nfound); } - if (*cmd == (struct cmd_list_element *) -1) + if (*cmd == CMD_LIST_AMBIGUOUS) { return 0; /* ambiguous */ } Index: cli/cli-decode.h =================================================================== RCS file: /cvs/src/src/gdb/cli/cli-decode.h,v retrieving revision 1.37 diff -u -p -r1.37 cli-decode.h --- cli/cli-decode.h 1 Jan 2011 15:33:20 -0000 1.37 +++ cli/cli-decode.h 11 Mar 2011 20:55:25 -0000 @@ -210,6 +210,9 @@ struct cmd_list_element struct cmd_list_element *alias_chain; }; +/* Flag for an ambiguous cmd_list result. */ +#define CMD_LIST_AMBIGUOUS ((struct cmd_list_element *) -1) + /* API to the manipulation of command lists. */ extern struct cmd_list_element *add_cmd (char *, enum command_class, --------------070500010001000802090901--