aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2011-03-12 22:59:24 +0000
committerMichael Snyder <msnyder@vmware.com>2011-03-12 22:59:24 +0000
commit1427fe5e740df1581923abd4bfaa4b9119fda0e4 (patch)
treeb79210aec7e28e192e01553df08c4b3fa34d3c8b
parent52bc799a91cd19a56cb59a9ecd29c0f63153c302 (diff)
downloadgdb-1427fe5e740df1581923abd4bfaa4b9119fda0e4.zip
gdb-1427fe5e740df1581923abd4bfaa4b9119fda0e4.tar.gz
gdb-1427fe5e740df1581923abd4bfaa4b9119fda0e4.tar.bz2
2011-03-11 Michael Snyder <msnyder@vmware.com>
* 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.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/cli/cli-decode.c8
-rw-r--r--gdb/cli/cli-decode.h3
-rw-r--r--gdb/completer.c4
-rw-r--r--gdb/top.c3
5 files changed, 16 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5b76bee..cb5bb35 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2011-03-11 Michael Snyder <msnyder@vmware.com>
+ * 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.
+
* event-loop-c (delete_async_signal_handler): Assert prev_ptr.
(delete_async_event_handler): Ditto.
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 4c1b412..093fec0 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -1228,7 +1228,7 @@ lookup_cmd_1 (char **text, struct cmd_list_element *clist,
/* 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_list_element *clist,
*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_element *list, char *cmdtype,
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 */
}
diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h
index 095b33d..e974968 100644
--- a/gdb/cli/cli-decode.h
+++ b/gdb/cli/cli-decode.h
@@ -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,
diff --git a/gdb/completer.c b/gdb/completer.c
index 18f01f9..606f78b 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -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;
diff --git a/gdb/top.c b/gdb/top.c
index c453a71..a25550f 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1425,8 +1425,7 @@ set_verbose (char *args, int from_tty, struct cmd_list_element *c)
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)
{