From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 42480 invoked by alias); 10 May 2017 14:13:20 -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 42448 invoked by uid 89); 10 May 2017 14:13:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=hits 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; Wed, 10 May 2017 14:13:17 +0000 Received: by simark.ca (Postfix, from userid 33) id 005021E561; Wed, 10 May 2017 10:13:18 -0400 (EDT) To: "Wiederhake, Tim" Subject: Re: [PATCH v3 10/12] btrace: Replace struct btrace_thread_info::segment. 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: Wed, 10 May 2017 14:13:00 -0000 From: Simon Marchi Cc: gdb-patches@sourceware.org, "Metzger, Markus T" In-Reply-To: <9676A094AF46E14E8265E7A3F4CCE9AF3C14CFE1@irsmsx105.ger.corp.intel.com> References: <1494312929-22749-1-git-send-email-tim.wiederhake@intel.com> <1494312929-22749-11-git-send-email-tim.wiederhake@intel.com> <9676A094AF46E14E8265E7A3F4CCE9AF3C14CFE1@irsmsx105.ger.corp.intel.com> Message-ID: X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.2.5 X-IsSubscribed: yes X-SW-Source: 2017-05/txt/msg00277.txt.bz2 On 2017-05-10 07:46, Wiederhake, Tim wrote: >> Btw #2, I thing this function could be more efficient (or maybe I >> don't >> understand as well as I think). If bfun at function entry is in the >> middle of a long list of segments, it will start from there and >> iterate >> backwards until it hits the first segment. > > Correct so far. > >> But because the same bfun >> variable is reused, it will iterate forward from the start > > We saved PREV and NEXT beforehand and use BFUN as a temporary variable > afterwards. The second "for" loop starts at NEXT, which is one past the > original "middle of the long list of segments". Ah, hence the need to save next before the first loop. For some reason I thought the second loop was initialized from bfun. Sorry about that. Simon