From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by sourceware.org (Postfix) with ESMTPS id 32966386F47A for ; Thu, 25 Jun 2020 17:32:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 32966386F47A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=alves.ped@gmail.com Received: by mail-wr1-f67.google.com with SMTP id h15so6704677wrq.8 for ; Thu, 25 Jun 2020 10:32:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=E2SXTDn9cqpyQhjpvxNUjo4XunjdZpcGdyPorTk7ams=; b=sqnJ8nr86ka6qFqZEEUMCFuAfMEUYIr2nqaD5tAVIrrVpCrJR3ERs0tbWX85/M5F9+ gyCuin9PDrq2Z9y9FMK0mq6FHvmWP+gYgT5XubdiPUFGDmNDFc91J4Ps5E/D2xUrGecH eFoawRIoB50qdZt5iTt57KXuuy8XCM2dWZk61lXujtTrqwgaywoAzdn45/3zcp7aZtpI RgLE4ixPU+sL5c4ZTbeuG1vrUu53jB2IFv0jk1maPWkgipPLMEtakRJSUmBpJo7W//nw NE0f1eXEHmtyklxwkuBfgxuh3FnhzCQfKNwbD28GvbGMU2m+33EMwBPE71nt8LPUDBid GypA== X-Gm-Message-State: AOAM530Ta5i3rOXmLZu7fvUYrDT3fu1Bu9w1Ddogcj/zd7Tk42Om+Usy uRK6csMtK8nI48ZwLiUGcfsmHeNtNt0= X-Google-Smtp-Source: ABdhPJynyoeNmSW9B0YfFfBJYUXtPp83SkJYubbyBM8e3gQUnS4MGMcKaC7Jt2QvBLUwZgQxp7NN4Q== X-Received: by 2002:adf:b6a4:: with SMTP id j36mr10613509wre.260.1593106375393; Thu, 25 Jun 2020 10:32:55 -0700 (PDT) Received: from ?IPv6:2001:8a0:f922:c400:56ee:75ff:fe8d:232b? ([2001:8a0:f922:c400:56ee:75ff:fe8d:232b]) by smtp.gmail.com with ESMTPSA id 104sm33504722wrl.25.2020.06.25.10.32.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 25 Jun 2020 10:32:54 -0700 (PDT) Subject: Re: [PATCH] gdb: make inferior::terminal a unique ptr To: Simon Marchi , gdb-patches@sourceware.org References: <20200625155517.32173-1-simon.marchi@efficios.com> From: Pedro Alves Message-ID: <362a9ac5-7417-8250-ff07-28d31df97f08@palves.net> Date: Thu, 25 Jun 2020 18:32:49 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20200625155517.32173-1-simon.marchi@efficios.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2020 17:32:58 -0000 On 6/25/20 4:55 PM, Simon Marchi via Gdb-patches wrote: > This changes the inferior::terminal field to be a unique pointer, so its > deallocation is automatically managed. > > gdb/ChangeLog: > > * inferior.h (struct inferior) : Change type to > gdb::unique_xmalloc_ptr. > * inferior.c (inferior::~inferior): Don't free inf->terminal. > * infcmd.c (set_inferior_io_terminal): Don't free terminal > field, adjust to unique pointer. > (get_inferior_io_terminal): Adjust to unique pointer. > LGTM. This reminds me of this patch: https://github.com/palves/gdb/commit/f240d57e3e659d13a01d9dda79120e2ce6bc7e74 IMO, the code is more readable with that. WDYT? Thanks, Pedro Alves