From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27842 invoked by alias); 15 Nov 2012 22:00:08 -0000 Received: (qmail 27825 invoked by uid 22791); 15 Nov 2012 22:00:07 -0000 X-SWARE-Spam-Status: No, hits=-6.7 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 15 Nov 2012 21:59:56 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qAFLxt0P004523 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 15 Nov 2012 16:59:55 -0500 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qAFLxsf1007640 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 15 Nov 2012 16:59:55 -0500 From: Tom Tromey To: Keith Seitz Cc: "gdb-patches\@sourceware.org ml" Subject: Re: [RFA] c++/13615 References: <505119AE.6040401@redhat.com> <87sja4wlqt.fsf@fleche.redhat.com> <506F38C2.4050107@redhat.com> <874nkzhi6p.fsf@fleche.redhat.com> <87zk2rg3if.fsf@fleche.redhat.com> <50A41182.2020500@redhat.com> Date: Thu, 15 Nov 2012 22:00:00 -0000 In-Reply-To: <50A41182.2020500@redhat.com> (Keith Seitz's message of "Wed, 14 Nov 2012 13:47:46 -0800") Message-ID: <87zk2iv86d.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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: 2012-11/txt/msg00445.txt.bz2 >>>>> "Keith" == Keith Seitz writes: Keith> I've added a test for this and updated the patch to correct that bug. Thanks. Keith> ChangeLog Keith> 2012-11-14 Keith Seitz Keith> c++/13615 The commit message parser needs to see the text "PR" in there: PR c++/13615 Keith> +static struct symbol * Keith> +find_symbol_in_baseclass (struct type *parent_type, const char *name, Keith> + const struct block *block) Keith> +{ Three minor notes here... Keith> + cleanup = make_cleanup (null_cleanup, NULL); Keith> + for (i = 0; i < TYPE_N_BASECLASSES (parent_type); ++i) Keith> + { Keith> + const char *base_name = TYPE_BASECLASS_NAME (parent_type, i); First, can this ever be NULL? Keith> + discard_cleanups (cleanup); Keith> + concatenated_name = xrealloc (concatenated_name, Keith> + (strlen (base_name) + 2 Keith> + + strlen (name) + 1)); Keith> + cleanup = make_cleanup (xfree, concatenated_name); Second, I was confused by this code the first time through -- discarding the cleanup and then re-creating it is a bit unusual. I think it would be simpler & cleaner to do something like: char *concatenated_name = NULL; struct cleanup *cleanup = make_cleanup (free_current_contents, &concatenated_name); ... and then just ignore the cleanup chain in the loop. Keith> + sprintf (concatenated_name, "%s::%s", base_name, name); ... or maybe some other approach since we're trying to get rid of sprintf uses. Otherwise this looks good to me. Tom