From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10401 invoked by alias); 1 Mar 2011 20:37:13 -0000 Received: (qmail 10391 invoked by uid 22791); 1 Mar 2011 20:37:12 -0000 X-SWARE-Spam-Status: No, hits=-5.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,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; Tue, 01 Mar 2011 20:37:08 +0000 Received: from mailhost2.vmware.com (mailhost2.vmware.com [10.16.67.167]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id F2C571307E; Tue, 1 Mar 2011 12:37:06 -0800 (PST) Received: from msnyder-server.eng.vmware.com (promd-2s-dhcp138.eng.vmware.com [10.20.124.138]) by mailhost2.vmware.com (Postfix) with ESMTP id E9D978EEA2; Tue, 1 Mar 2011 12:37:06 -0800 (PST) Message-ID: <4D6D58F2.8070207@vmware.com> Date: Tue, 01 Mar 2011 20:37:00 -0000 From: Michael Snyder User-Agent: Thunderbird 2.0.0.24 (X11/20101201) MIME-Version: 1.0 To: "gdb-patches@sourceware.org" , Pierre Muller Subject: [RFA] p-typeprint.c, move pointer use to after null-check. Content-Type: multipart/mixed; boundary="------------060604070000050301050504" 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/msg00042.txt.bz2 This is a multi-part message in MIME format. --------------060604070000050301050504 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 41 If it's worth checking for null... OK? --------------060604070000050301050504 Content-Type: text/plain; name="reversenull2.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="reversenull2.txt" Content-length: 1180 2011-03-01 Michael Snyder * 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])) --------------060604070000050301050504--