From patchwork Tue Sep 9 03:51:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Evans X-Patchwork-Id: 2698 Received: (qmail 3697 invoked by alias); 9 Sep 2014 03:51:58 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 3666 invoked by uid 89); 9 Sep 2014 03:51:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f172.google.com Received: from mail-pd0-f172.google.com (HELO mail-pd0-f172.google.com) (209.85.192.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 09 Sep 2014 03:51:53 +0000 Received: by mail-pd0-f172.google.com with SMTP id v10so9187820pde.17 for ; Mon, 08 Sep 2014 20:51:51 -0700 (PDT) X-Received: by 10.66.179.140 with SMTP id dg12mr35831820pac.76.1410234711328; Mon, 08 Sep 2014 20:51:51 -0700 (PDT) Received: from seba.sebabeach.org.gmail.com (173-13-178-50-sfba.hfc.comcastbusiness.net. [173.13.178.50]) by mx.google.com with ESMTPSA id o2sm10272493pdk.87.2014.09.08.20.51.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Sep 2014 20:51:50 -0700 (PDT) From: Doug Evans To: gdb-patches@sourceware.org Subject: [OB PATCH] Replace use of magic number in scm-cmd.c/py-cmd.c Date: Mon, 08 Sep 2014 20:51:09 -0700 Message-ID: MIME-Version: 1.0 X-IsSubscribed: yes Hi. I happened across this. Checked in as obvious. 2014-09-08 Doug Evans * 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. 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);