From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25067 invoked by alias); 11 Jul 2018 14:16:33 -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 24871 invoked by uid 89); 11 Jul 2018 14:16:24 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: gateway24.websitewelcome.com Received: from gateway24.websitewelcome.com (HELO gateway24.websitewelcome.com) (192.185.51.59) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 11 Jul 2018 14:16:23 +0000 Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway24.websitewelcome.com (Postfix) with ESMTP id 48C8E6C3B for ; Wed, 11 Jul 2018 09:16:21 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id dFuNfGGLzkBj6dFubfdFOo; Wed, 11 Jul 2018 09:16:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type: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=VrQva6vFbn0ccMYUH/v9LKh9m4ictEPzB+sKYlvAX5E=; b=qKF5giRt5mTGwPC6+WLzw0q5jw jk9o3Yw66JWM9PPBci3nd87euOkkf87g+ErvCX2yjkYsvW3Bq6D1sAcOmMzJPzygbdKvCTORz6Ol+ Hds2qRCV52oQuu36Q2YE8UUBW; Received: from 75-166-85-72.hlrn.qwest.net ([75.166.85.72]:49352 helo=pokyo.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1fdFuN-000rOq-3F; Wed, 11 Jul 2018 09:15:55 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 3/5] Use new and delete for struct infcall_control_state Date: Wed, 11 Jul 2018 14:16:00 -0000 Message-Id: <20180711141552.10136-4-tom@tromey.com> In-Reply-To: <20180711141552.10136-1-tom@tromey.com> References: <20180711141552.10136-1-tom@tromey.com> X-SW-Source: 2018-07/txt/msg00305.txt.bz2 This changes infrun.c to use new and delete for infcall_control_state. gdb/ChangeLog 2018-07-11 Tom Tromey * infrun.c (struct infcall_control_state): Add initializers. (save_infcall_control_state): Use new. (restore_infcall_control_state, discard_infcall_control_state): Use delete. --- gdb/ChangeLog | 7 +++++++ gdb/infrun.c | 17 ++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d46ccf53999..95d4f51f62c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2018-07-11 Tom Tromey + + * infrun.c (struct infcall_control_state): Add initializers. + (save_infcall_control_state): Use new. + (restore_infcall_control_state, discard_infcall_control_state): + Use delete. + 2018-07-11 Tom Tromey * infrun.c (struct infcall_suspend_state) : Now a diff --git a/gdb/infrun.c b/gdb/infrun.c index 1157b266b1a..3bc8dc03830 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -8927,15 +8927,15 @@ get_infcall_suspend_state_regcache (struct infcall_suspend_state *inf_state) struct infcall_control_state { - struct thread_control_state thread_control; - struct inferior_control_state inferior_control; + struct thread_control_state thread_control {}; + struct inferior_control_state inferior_control {}; /* Other fields: */ - enum stop_stack_kind stop_stack_dummy; - int stopped_by_random_signal; + enum stop_stack_kind stop_stack_dummy = STOP_NONE; + int stopped_by_random_signal = 0; /* ID if the selected frame when the inferior function call was made. */ - struct frame_id selected_frame_id; + struct frame_id selected_frame_id {}; }; /* Save all of the information associated with the inferior<==>gdb @@ -8944,8 +8944,7 @@ struct infcall_control_state struct infcall_control_state * save_infcall_control_state (void) { - struct infcall_control_state *inf_status = - XNEW (struct infcall_control_state); + struct infcall_control_state *inf_status = new struct infcall_control_state; struct thread_info *tp = inferior_thread (); struct inferior *inf = current_inferior (); @@ -9031,7 +9030,7 @@ restore_infcall_control_state (struct infcall_control_state *inf_status) END_CATCH } - xfree (inf_status); + delete inf_status; } static void @@ -9061,7 +9060,7 @@ discard_infcall_control_state (struct infcall_control_state *inf_status) /* See save_infcall_control_state for info on stop_bpstat. */ bpstat_clear (&inf_status->thread_control.stop_bpstat); - xfree (inf_status); + delete inf_status; } /* See infrun.h. */ -- 2.17.1