From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5732 invoked by alias); 1 May 2008 17:29:21 -0000 Received: (qmail 5723 invoked by uid 22791); 1 May 2008 17:29:21 -0000 X-Spam-Check-By: sourceware.org Received: from imr2.ericy.com (HELO imr2.ericy.com) (198.24.6.3) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 01 May 2008 17:28:50 +0000 Received: from eusrcmw750.eamcs.ericsson.se (eusrcmw750.exu.ericsson.se [138.85.77.50]) by imr2.ericy.com (8.13.1/8.13.1) with ESMTP id m41HSjk7032473; Thu, 1 May 2008 12:28:45 -0500 Received: from ecamlmw720.eamcs.ericsson.se ([142.133.1.72]) by eusrcmw750.eamcs.ericsson.se with Microsoft SMTPSVC(6.0.3790.1830); Thu, 1 May 2008 12:28:45 -0500 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: [PATCH:MI] Return a subset of a variable object's children Date: Thu, 01 May 2008 17:29:00 -0000 Message-ID: <6D19CA8D71C89C43A057926FE0D4ADAA04E1BD0F@ecamlmw720.eamcs.ericsson.se> References: <6D19CA8D71C89C43A057926FE0D4ADAA042910B7@ecamlmw720.eamcs.ericsson.se> <200805011955.54191.vladimir@codesourcery.com> From: "Marc Khouzam" To: "Vladimir Prus" Cc: "Nick Roberts" , 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: 2008-05/txt/msg00013.txt.bz2 > > How about something like this (assuming quick_push does what I think it= does) > >=20 > > var->children =3D VEC_alloc(varobj_p, var->num_children); > > for (i=3D0; inum_children; i++) > > VEC_quick_push (varobj_p, var->children, NULL); > >=20 > > Same loop, but it avoids having to reallocate the vector. >=20 > Yes, it's a bit more efficient. In fact, I actually just read the vec.h header comment and that is pretty much what is recommended. In fact, the size value passed to VEC_alloc should probably be negative here, to have even more efficiency, since we know the vector won't grow. But that is no longer the case with Nick's patch, as the vector will keep on growing.