From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 90607 invoked by alias); 1 Dec 2016 20:22:43 -0000 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 Received: (qmail 90594 invoked by uid 89); 1 Dec 2016 20:22:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=HX-PHP-Originating-Script:rcube.php X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 01 Dec 2016 20:22:41 +0000 Received: by simark.ca (Postfix, from userid 33) id BF70B1E144; Thu, 1 Dec 2016 15:22:39 -0500 (EST) To: Pedro Alves Subject: Re: [PATCH 13/22] Replace hand-made linked list of ui_out_hdr by vector and iterator X-PHP-Originating-Script: 33:rcube.php MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 01 Dec 2016 20:22:00 -0000 From: Simon Marchi Cc: gdb-patches@sourceware.org In-Reply-To: References: <20161124152428.24725-1-simon.marchi@polymtl.ca> <20161124152710.25007-13-simon.marchi@polymtl.ca> <837e3dd8-c636-48e2-be9f-79ab23026db8@redhat.com> Message-ID: <084b971eca7e35c1215ec89dd7a8680b@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.2.2 X-IsSubscribed: yes X-SW-Source: 2016-12/txt/msg00055.txt.bz2 On 2016-11-26 11:13, Simon Marchi wrote: > On 2016-11-24 13:41, Pedro Alves wrote: >> On 11/24/2016 03:27 PM, Simon Marchi wrote: >>> Instead of keeping pointers to first, last and current ui_out_hdr in >>> ui_out_table, we can use an std::vector and an iterator. Direct >>> random >>> access of to vector helps make get_next_header a bit nicer by >>> avoiding >>> iterating on all the headers. append_header_to_list is also a bit >>> simpler. >> >> Inserting into a vector invalidates iterators if it causes >> reallocation. >> I think we're good because there's be some call to start_body >> or start_row before the iterator is ever dereferenced, right? >> >> Thanks, >> Pedro Alves > > start_body and start_row is the terminology introduced in a later > patch, but you are right. The table generation is in two phases: > > 1. define the headers > 2. generate the body/rows > > In 1, we modify the vector but don't use the iterator, whereas in 2 we > use the iterator but don't modify the vector. The various table state > checks should validate that we don't try to define a new header while > we are in phase 2, for example. Just to be sure, is this patch OK?