From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 91025 invoked by alias); 13 Dec 2019 20:57:26 -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 91017 invoked by uid 89); 13 Dec 2019 20:57:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.1 spammy=H*M:923d X-HELO: us-smtp-1.mimecast.com Received: from us-smtp-delivery-1.mimecast.com (HELO us-smtp-1.mimecast.com) (205.139.110.120) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 13 Dec 2019 20:57:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576270643; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lAUOj7wBeYx9U8y7geiwKe8WmC6evnGSVlq+9h8pbeM=; b=QsjooJQJZ1mDBi4lq8H/TIuTL/HHQTw5D+QnoxbABgLj8T9CsgCyJjeqyNTCI1Jle7im8o 94gkTh7x+3JbYRPXvI7a1leaDWkm438dcUsK2ejPmZq7C2LspZnysIbaFfu7uxn7/uhjyE JkDIOXSrwwEsvbCkONhK00C6IoQr0vY= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-138-kJLjhwQaOXSijVF9yp0kXg-1; Fri, 13 Dec 2019 15:57:22 -0500 Received: by mail-wr1-f71.google.com with SMTP id t3so45399wrm.23 for ; Fri, 13 Dec 2019 12:57:21 -0800 (PST) Return-Path: Received: from ?IPv6:2001:8a0:f913:f700:56ee:75ff:fe8d:232b? ([2001:8a0:f913:f700:56ee:75ff:fe8d:232b]) by smtp.gmail.com with ESMTPSA id x26sm11434426wmc.30.2019.12.13.12.57.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 13 Dec 2019 12:57:19 -0800 (PST) Subject: Re: [PATCH 6/7] jit: c++-ify gdb_block To: Simon Marchi , Christian Biesinger References: <20191213060323.1799590-1-simon.marchi@polymtl.ca> <20191213060323.1799590-7-simon.marchi@polymtl.ca> <06ec7caa-e2ed-e560-9456-0755d246633f@polymtl.ca> Cc: gdb-patches From: Pedro Alves Message-ID: Date: Fri, 13 Dec 2019 20:57:00 -0000 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: <06ec7caa-e2ed-e560-9456-0755d246633f@polymtl.ca> X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-12/txt/msg00611.txt.bz2 On 12/13/19 3:18 PM, Simon Marchi wrote: > On 2019-12-13 10:10 a.m., Christian Biesinger via gdb-patches wrote: >>> @@ -455,10 +463,7 @@ struct gdb_symtab >>> ~gdb_symtab () >>> { >>> for (gdb_block *gdb_block_iter : this->blocks) >>> - { >>> - xfree ((void *) gdb_block_iter->name); >>> - xfree (gdb_block_iter); >>> - } >>> + delete gdb_block_iter; >>> } >>> >> >> Have you considered making this a vector of unique_ptrs, so you don't have >> to manually delete them? > > Yes, it's done in the following patch. I went perhaps a bit overboard with the > patch splitting, but I prefer to do these changes in many smaller patches, so that > if something goes wrong, it's easier to identify the culprit. I wonder whether it wouldn't be simpler to use std::list for these cases. Thanks, Pedro Alves