From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (wildebeest.demon.nl [212.238.236.112]) by sourceware.org (Postfix) with ESMTPS id 8DC20385480C for ; Wed, 18 Nov 2020 23:19:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8DC20385480C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mark@klomp.org Received: from librem (deer0x15.wildebeest.org [172.31.17.151]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 8B33E302BBED; Thu, 19 Nov 2020 00:19:10 +0100 (CET) Received: by librem (Postfix, from userid 1000) id CFCE1C0EA1; Thu, 19 Nov 2020 00:18:14 +0100 (CET) Date: Thu, 19 Nov 2020 00:18:14 +0100 From: Mark Wielaard To: Timm =?iso-8859-1?Q?B=E4der?= Cc: elfutils-devel@sourceware.org Subject: Re: [PATCH 02/14] segment_report_module: Pull segment_read into file scope Message-ID: <20201118231814.GC2684@wildebeest.org> References: <20201112150412.2137981-1-tbaeder@redhat.com> <20201112150412.2137981-3-tbaeder@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20201112150412.2137981-3-tbaeder@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Nov 2020 23:19:12 -0000 Hi Timm, On Thu, Nov 12, 2020 at 04:04:00PM +0100, Timm Bäder via Elfutils-devel wrote: > In preparation of getting rid of nested functions I actually like the nested functions in this case, they simply act as lambdas. But if you want to get rid of this one then can we inline the (*memory_callback) (dwfl, segndx, buffer, buffer_available, ...) call instead of introducing a new top-level function that shuffles the arguments around? So instead of: > - if (segment_read (ndx, &buffer, &buffer_available, > + if (segment_read (dwfl, memory_callback, memory_callback_arg, > + ndx, &buffer, &buffer_available, > start, sizeof (Elf64_Ehdr)) say: if (! (*memory_callback) (dwfl, ndx, &buffer, &buffer_available, start, sizeof (Elf64_Ehdr), memory_callback_arg)) Thanks, Mark