From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 47379 invoked by alias); 21 Jan 2020 19:57:48 -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 47370 invoked by uid 89); 21 Jan 2020 19:57:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-8.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:778 X-HELO: gateway30.websitewelcome.com Received: from gateway30.websitewelcome.com (HELO gateway30.websitewelcome.com) (192.185.198.26) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 21 Jan 2020 19:57:38 +0000 Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway30.websitewelcome.com (Postfix) with ESMTP id 037E514EBB for ; Tue, 21 Jan 2020 13:57:37 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id tzeaisOa59jb7tzebizF2t; Tue, 21 Jan 2020 13:57:37 -0600 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=LWhUsly6ehp3IJS5b3uN6LGw5xxB8zuhe3x0zGMutq8=; b=AMWSzXMtR0UzuZqgznupTBiQ3/ rS1SDTmxjsJkmxTvi8ZS6nJqyBETy23TCqJwmNrVGrZGJdGP5PGhbr8lhoctSuYjhWd0WEj44lhjq pINsPbsYo2fHSHBirKFtsteIy; Received: from 75-166-123-50.hlrn.qwest.net ([75.166.123.50]:37016 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1itzea-002E24-Om; Tue, 21 Jan 2020 12:57:36 -0700 From: Tom Tromey To: Simon Marchi Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] gdb: remove uses of iterate_over_inferiors in remote-sim.c References: <20200121021306.19200-1-simon.marchi@efficios.com> Date: Tue, 21 Jan 2020 20:17:00 -0000 In-Reply-To: <20200121021306.19200-1-simon.marchi@efficios.com> (Simon Marchi's message of "Mon, 20 Jan 2020 21:13:06 -0500") Message-ID: <87v9p48tvz.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2020-01/txt/msg00648.txt.bz2 >>>>> "Simon" == Simon Marchi writes: Simon> This removes the two uses of iterate_over_inferiors, in favor of Simon> range-based loops. Hah, I was writing the same patch :) Simon> +static void Simon> +gdbsim_interrupt_inferior (struct inferior *inf) Simon> { Simon> struct sim_inferior_data *sim_data Simon> = get_sim_inferior_data (inf, SIM_INSTANCE_NEEDED); Simon> - if (sim_data) Simon> + if (sim_data != nullptr) Simon> { Simon> if (!sim_stop (sim_data->gdbsim_desc)) This could be shortened to using an "&&" instead of a nested if. And, I think it would be clearer still to remove gdbsim_interrupt_inferior and just inline the body into gdbsim_target::interrupt. Tom