[OB] Replace use of magic number in scm-cmd.c/py-cmd.c

Message ID m34mwhtpsi.fsf@sspiff.org
State New, archived
Headers

Commit Message

Doug Evans Sept. 9, 2014, 3:51 a.m. UTC
  Hi.

I happened across this.
Checked in as obvious.

2014-09-08  Doug Evans  <xdje42@gmail.com>

	* guile/scm-cmd.c (gdbscm_parse_command_name): Replace magic number
	with named constant.  Fix style of pointer comparison.
	* python/py-cmd.c (gdbpy_parse_command_name): Ditto.
  

Patch

diff --git a/gdb/guile/scm-cmd.c b/gdb/guile/scm-cmd.c
index 54bed2c..2c4b2f8 100644
--- a/gdb/guile/scm-cmd.c
+++ b/gdb/guile/scm-cmd.c
@@ -531,7 +531,7 @@  gdbscm_parse_command_name (const char *name,
 
   prefix_text2 = prefix_text;
   elt = lookup_cmd_1 (&prefix_text2, *start_list, NULL, 1);
-  if (!elt || elt == (struct cmd_list_element *) -1)
+  if (elt == NULL || elt == CMD_LIST_AMBIGUOUS)
     {
       msg = xstrprintf (_("could not find command prefix '%s'"), prefix_text);
       xfree (prefix_text);
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
index 8bc4bf7..45af66b 100644
--- a/gdb/python/py-cmd.c
+++ b/gdb/python/py-cmd.c
@@ -487,7 +487,7 @@  gdbpy_parse_command_name (const char *name,
 
   prefix_text2 = prefix_text;
   elt = lookup_cmd_1 (&prefix_text2, *start_list, NULL, 1);
-  if (!elt || elt == (struct cmd_list_element *) -1)
+  if (elt == NULL || elt == CMD_LIST_AMBIGUOUS)
     {
       PyErr_Format (PyExc_RuntimeError, _("Could not find command prefix %s."),
 		    prefix_text);