From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id 770F3388CC1D for ; Thu, 6 May 2021 16:49:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 770F3388CC1D X-ASG-Debug-ID: 1620319798-0c856e67e2f5d0f0001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id Q45P9wuJu8M6EBhM (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 06 May 2021 12:49:58 -0400 (EDT) X-Barracuda-Envelope-From: simon.marchi@polymtl.ca X-Barracuda-RBL-Trusted-Forwarder: 96.127.255.82 Received: from simark.localdomain (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) by smtp.ebox.ca (Postfix) with ESMTP id 3FC2C441D65; Thu, 6 May 2021 12:49:58 -0400 (EDT) From: Simon Marchi X-Barracuda-RBL-IP: 192.222.157.6 X-Barracuda-Effective-Source-IP: 192-222-157-6.qc.cable.ebox.net[192.222.157.6] X-Barracuda-Apparent-Source-IP: 192.222.157.6 To: gdb-patches@sourceware.org Subject: [PATCH 3/4] gdb: (de-)allocate target_desc_info with new/delete Date: Thu, 6 May 2021 12:49:56 -0400 X-ASG-Orig-Subj: [PATCH 3/4] gdb: (de-)allocate target_desc_info with new/delete Message-Id: <20210506164957.101572-3-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210506164957.101572-1-simon.marchi@polymtl.ca> References: <20210506164957.101572-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Barracuda-Connect: smtp.ebox.ca[96.127.255.82] X-Barracuda-Start-Time: 1620319798 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://96.127.255.19:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-Scan-Msg-Size: 1901 X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=8.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.89758 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-Spam-Status: No, score=-19.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_QUARANTINE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_SOFTFAIL, 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, 06 May 2021 16:50:00 -0000 In preparation for using non-POD types in the struct. gdb/ChangeLog: * target-descriptions.c (struct target_desc_info): Initialize fields. (get_tdesc_info): Use new. (target_desc_info_free): Use delete. Change-Id: I10fdaeeae7cdbd7930ae7adeeb13f7f363c67c7a --- gdb/target-descriptions.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c index aee1478301b6..341020fed762 100644 --- a/gdb/target-descriptions.c +++ b/gdb/target-descriptions.c @@ -446,7 +446,7 @@ struct target_desc_info /* A flag indicating that a description has already been fetched from the target, so it should not be queried again. */ - bool fetched; + bool fetched = false; /* The description fetched from the target, or NULL if the target did not supply any description. Only valid when @@ -454,12 +454,12 @@ struct target_desc_info code should access this; normally, the description should be accessed through the gdbarch object. */ - const struct target_desc *tdesc; + const struct target_desc *tdesc = nullptr; /* The filename to read a target description from, as set by "set tdesc filename ..." */ - char *filename; + char *filename = nullptr; }; /* Get the inferior INF's target description info, allocating one on @@ -469,7 +469,8 @@ static struct target_desc_info * get_tdesc_info (struct inferior *inf) { if (inf->tdesc_info == NULL) - inf->tdesc_info = XCNEW (struct target_desc_info); + inf->tdesc_info = new target_desc_info; + return inf->tdesc_info; } @@ -507,7 +508,7 @@ target_desc_info_free (struct target_desc_info *tdesc_info) if (tdesc_info != NULL) { xfree (tdesc_info->filename); - xfree (tdesc_info); + delete tdesc_info; } } -- 2.30.1