From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 47946 invoked by alias); 23 Jun 2019 22:43:45 -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 47804 invoked by uid 89); 23 Jun 2019 22:43:43 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.8 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.1 spammy= X-HELO: gateway33.websitewelcome.com Received: from gateway33.websitewelcome.com (HELO gateway33.websitewelcome.com) (192.185.145.24) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 23 Jun 2019 22:43:41 +0000 Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway33.websitewelcome.com (Postfix) with ESMTP id 43CEB14195 for ; Sun, 23 Jun 2019 17:43:40 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id fBD2hfHlV2qH7fBD2hoQ94; Sun, 23 Jun 2019 17:43:40 -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=nAetM7/SDPvuJFm6TttnQEr5GUrYNzXnSa5F8wtLSjQ=; b=eKTdcjLnEEbZfWwNFyWECx4iya Kv70bCi6Mo/cuxCW8pjcHgdqypFa4+LHNLTAeyrJMKk1vrRf71DTuxW5vDyGvEdh/T0RGclWqmciX thgL1ndT2h7rkLHN0scn9+bBP; Received: from 75-166-12-78.hlrn.qwest.net ([75.166.12.78]:54396 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1hfBD2-000vDQ-1t; Sun, 23 Jun 2019 17:43:40 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 09/66] Split the tui_win_info destructor Date: Sun, 23 Jun 2019 22:44:00 -0000 Message-Id: <20190623224329.16060-10-tom@tromey.com> In-Reply-To: <20190623224329.16060-1-tom@tromey.com> References: <20190623224329.16060-1-tom@tromey.com> X-SW-Source: 2019-06/txt/msg00473.txt.bz2 This patch adds destructors to tui_source_window and tui_data_window, and splits ~tui_win_info as appropriate. gdb/ChangeLog 2019-06-23 Tom Tromey * tui/tui-data.h (struct tui_source_window) (struct tui_data_window): Declare destructors. * tui/tui-data.c (~tui_source_window, ~tui_data_window): New destructors. (tui_win_info): Simplify. --- gdb/ChangeLog | 8 ++++++ gdb/tui/tui-data.c | 70 ++++++++++++++++++++++------------------------ gdb/tui/tui-data.h | 2 ++ 3 files changed, 43 insertions(+), 37 deletions(-) diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c index d98f916ac5b..8993bfe5d47 100644 --- a/gdb/tui/tui-data.c +++ b/gdb/tui/tui-data.c @@ -617,47 +617,43 @@ tui_add_content_elements (struct tui_gen_win_info *win_info, return index_start; } -tui_win_info::~tui_win_info () +tui_source_window::~tui_source_window () { - struct tui_gen_win_info *generic_win; + if (detail.source_info.fullname) + { + xfree (detail.source_info.fullname); + detail.source_info.fullname = NULL; + } + struct tui_gen_win_info *generic_win = detail.source_info.execution_info; + if (generic_win != NULL) + { + tui_delete_win (generic_win->handle); + generic_win->handle = NULL; + tui_free_win_content (generic_win); + } +} - switch (generic.type) +tui_data_window::~tui_data_window () +{ + if (generic.content != NULL) { - case SRC_WIN: - case DISASSEM_WIN: - if (detail.source_info.fullname) - { - xfree (detail.source_info.fullname); - detail.source_info.fullname = NULL; - } - generic_win = detail.source_info.execution_info; - if (generic_win != NULL) - { - tui_delete_win (generic_win->handle); - generic_win->handle = NULL; - tui_free_win_content (generic_win); - } - break; - case DATA_WIN: - if (generic.content != NULL) - { - tui_free_data_content (detail.data_display_info.regs_content, - detail.data_display_info.regs_content_count); - detail.data_display_info.regs_content = NULL; - detail.data_display_info.regs_content_count = 0; - tui_free_data_content (detail.data_display_info.data_content, - detail.data_display_info.data_content_count); - detail.data_display_info.data_content = NULL; - detail.data_display_info.data_content_count = 0; - detail.data_display_info.regs_column_count = 1; - detail.data_display_info.display_regs = FALSE; - generic.content = NULL; - generic.content_size = 0; - } - break; - default: - break; + tui_free_data_content (detail.data_display_info.regs_content, + detail.data_display_info.regs_content_count); + detail.data_display_info.regs_content = NULL; + detail.data_display_info.regs_content_count = 0; + tui_free_data_content (detail.data_display_info.data_content, + detail.data_display_info.data_content_count); + detail.data_display_info.data_content = NULL; + detail.data_display_info.data_content_count = 0; + detail.data_display_info.regs_column_count = 1; + detail.data_display_info.display_regs = FALSE; + generic.content = NULL; + generic.content_size = 0; } +} + +tui_win_info::~tui_win_info () +{ if (generic.handle != NULL) { tui_delete_win (generic.handle); diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h index d07862f29f8..2a775a42be8 100644 --- a/gdb/tui/tui-data.h +++ b/gdb/tui/tui-data.h @@ -294,6 +294,7 @@ public: struct tui_source_window : public tui_win_info { tui_source_window (enum tui_win_type type); + ~tui_source_window () override; DISABLE_COPY_AND_ASSIGN (tui_source_window); void clear_detail () override; @@ -302,6 +303,7 @@ struct tui_source_window : public tui_win_info struct tui_data_window : public tui_win_info { tui_data_window (); + ~tui_data_window () override; DISABLE_COPY_AND_ASSIGN (tui_data_window); void clear_detail () override; -- 2.17.2