From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6991 invoked by alias); 15 Jun 2010 18:11:54 -0000 Received: (qmail 6975 invoked by uid 22791); 15 Jun 2010 18:11:53 -0000 X-SWARE-Spam-Status: No, hits=-5.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD 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; Tue, 15 Jun 2010 18:11:46 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o5FIBiox027193 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 15 Jun 2010 14:11:44 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o5FIBhlQ022522; Tue, 15 Jun 2010 14:11:44 -0400 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o5FIBh39010080; Tue, 15 Jun 2010 14:11:43 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id B2C88378F30; Tue, 15 Jun 2010 12:11:42 -0600 (MDT) From: Tom Tromey To: Phil Muldoon Cc: gdb-patches ml Subject: Re: [python][patch] Inferior and Thread information support. References: <4BFA6E82.3070704@redhat.com> <4C1623C1.6090205@redhat.com> Reply-To: tromey@redhat.com Date: Tue, 15 Jun 2010 18:11:00 -0000 In-Reply-To: <4C1623C1.6090205@redhat.com> (Phil Muldoon's message of "Mon, 14 Jun 2010 13:42:41 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: 2010-06/txt/msg00348.txt.bz2 >>>>> "Phil" == Phil Muldoon writes: Phil> I've no complaint to using obstacks. This function basically Phil> wraps/tidies the existing code that was just coded directly in a loop Phil> in parse_find_args. That code just realloc'd by a factor of two whenever Phil> the buffer was too small. This code is exactly the same, except it Phil> has been squirrelled away in a function. So we are not introducing or Phil> adding any more growable types in this patch, just moving the code Phil> bits that already existed into function. I'm not adverse to changing Phil> that code to use obstacks, that being said! Just for the record -- ordinarily I try not to request cleanups to existing code as part of a new patch. It is nice to get cleanups, and if you want to do them (or if there is a reason for them beyond mere tidiness) then that is great. But feel free to push back if I've erroneously reviewed the context and not the patch. Phil> + /* Find inferior_object for the given PID. */ Phil> + for (inf_entry = &gdbpy_inferior_list; *inf_entry != NULL; Phil> + inf_entry = &(*inf_entry)->next) Phil> + if ((*inf_entry)->inf_obj->inferior->pid == inf->pid) Phil> + break; > Tom> It seems strange to compare the pid fields when we could just compare Tom> the inferior objects themselves. Phil> Do you mean using the Python object's cmp inbuilt method here? No, I'm just curious why that can't be more simply written: if ((*inf_entry)->inf_obj == inf) Tom