Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@vmware.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	 Pierre Muller <muller@ics.u-strasbg.fr>
Subject: [RFA] p-typeprint.c, move pointer use to after null-check.
Date: Tue, 01 Mar 2011 20:37:00 -0000	[thread overview]
Message-ID: <4D6D58F2.8070207@vmware.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 41 bytes --]

If it's worth checking for null...

OK?


[-- Attachment #2: reversenull2.txt --]
[-- Type: text/plain, Size: 1180 bytes --]

2011-03-01  Michael Snyder  <msnyder@vmware.com>

	* p-typeprint.c (pascal_type_print_method_args): Don't use 
	pointer until after null-check.

Index: p-typeprint.c
===================================================================
RCS file: /cvs/src/src/gdb/p-typeprint.c,v
retrieving revision 1.38
diff -u -p -u -p -r1.38 p-typeprint.c
--- p-typeprint.c	10 Jan 2011 20:38:50 -0000	1.38
+++ p-typeprint.c	1 Mar 2011 20:34:08 -0000
@@ -156,18 +156,18 @@ void
 pascal_type_print_method_args (char *physname, char *methodname,
 			       struct ui_file *stream)
 {
-  int is_constructor = (strncmp (physname, "__ct__", 6) == 0);
-  int is_destructor = (strncmp (physname, "__dt__", 6) == 0);
-
-  if (is_constructor || is_destructor)
-    {
-      physname += 6;
-    }
-
   fputs_filtered (methodname, stream);
 
   if (physname && (*physname != 0))
     {
+      int is_constructor = (strncmp (physname, "__ct__", 6) == 0);
+      int is_destructor = (strncmp (physname, "__dt__", 6) == 0);
+
+      if (is_constructor || is_destructor)
+	{
+	  physname += 6;
+	}
+
       fputs_filtered (" (", stream);
       /* We must demangle this.  */
       while (isdigit (physname[0]))

             reply	other threads:[~2011-03-01 20:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-01 20:37 Michael Snyder [this message]
2011-03-07 20:19 ` Michael Snyder
2011-03-08  6:54 ` Joel Brobecker
2011-03-08 14:56   ` Pierre Muller
2011-03-08 15:30     ` Joel Brobecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D6D58F2.8070207@vmware.com \
    --to=msnyder@vmware.com \
    --cc=gdb-patches@sourceware.org \
    --cc=muller@ics.u-strasbg.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox