public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Split the tui_win_info destructor Date: Tue, 25 Jun 2019 13:57:00 -0000 [thread overview] Message-ID: <20190625135751.113660.qmail@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ee1d42d6c1a05725868a8ea4855eaa81cbbda635 commit ee1d42d6c1a05725868a8ea4855eaa81cbbda635 Author: Tom Tromey <tom@tromey.com> Date: Sun Jun 16 10:52:27 2019 -0600 Split the tui_win_info destructor This patch adds destructors to tui_source_window and tui_data_window, and splits ~tui_win_info as appropriate. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * 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. Diff: --- 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/ChangeLog b/gdb/ChangeLog index 412c442..434d7dd 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,13 @@ 2019-06-25 Tom Tromey <tom@tromey.com> + * 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. + +2019-06-25 Tom Tromey <tom@tromey.com> + * tui/tui-winsource.c (tui_display_main) (tui_update_source_windows_with_addr) (tui_update_all_breakpoint_info): Update. diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c index d9b8bd6..d24941c 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 8008893..7adeb56 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 { explicit 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;
reply other threads:[~2019-06-25 13:57 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190625135751.113660.qmail@sourceware.org \ --to=tromey@sourceware.org \ --cc=gdb-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).