aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui/tui-layout.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-10-01 17:29:49 -0600
committerTom Tromey <tom@tromey.com>2019-10-09 16:50:35 -0600
commit7523da63ca33a37b54c2cde18b7752d0f0f11c26 (patch)
tree9c89a33c5d2848fa4613e5b558136a6cd000fb24 /gdb/tui/tui-layout.c
parenta7798e7f7dd1c4226376d455af957e369aa2a192 (diff)
downloadfsf-binutils-gdb-7523da63ca33a37b54c2cde18b7752d0f0f11c26.zip
fsf-binutils-gdb-7523da63ca33a37b54c2cde18b7752d0f0f11c26.tar.gz
fsf-binutils-gdb-7523da63ca33a37b54c2cde18b7752d0f0f11c26.tar.bz2
Make TUI window handle a unique_ptr
This changes tui_gen_win_info::handle to be a specialization of unique_ptr. This is perhaps mildly uglier in some spots, due to the proliferation of "get"; but on the other hand it cleans up some manual management and it allows for the removal of tui_delete_win. gdb/ChangeLog 2019-10-09 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.h (tui_delete_win): Don't declare. * tui/tui-stack.c (tui_locator_window::rerender): Update. * tui/tui-command.c (tui_cmd_window::resize) (tui_refresh_cmd_win): Update. * tui/tui-win.c (tui_resize_all, tui_set_focus_command): Update. * tui/tui.c (tui_rl_other_window, tui_enable): Update. * tui/tui-data.c (~tui_gen_win_info): Remove. * tui/tui-layout.c (tui_gen_win_info::resize): Update. * tui/tui-io.c (update_cmdwin_start_line, tui_putc, tui_puts) (tui_redisplay_readline, tui_mld_flush) (tui_mld_erase_entire_line, tui_mld_getc, tui_getc): Update. * tui/tui-regs.c (tui_data_window::delete_data_content_windows) (tui_data_window::erase_data_content) (tui_data_item_window::rerender) (tui_data_item_window::refresh_window): Update. * tui/tui-wingeneral.c (tui_gen_win_info::refresh_window) (box_win, tui_gen_win_info::make_window) (tui_gen_win_info::make_visible): Update. (tui_delete_win): Remove. * tui/tui-winsource.c (tui_source_window_base::do_erase_source_content): Update. (tui_show_source_line, tui_source_window_base::update_tab_width) (tui_source_window_base::update_exec_info): Update. * tui/tui-data.h (struct curses_deleter): New. (struct tui_gen_win_info) <handle>: Now a unique_ptr. (struct tui_gen_win_info) <~tui_gen_win_info>: Define.
Diffstat (limited to 'gdb/tui/tui-layout.c')
-rw-r--r--gdb/tui/tui-layout.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index ccc750e..3a510f4 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -511,12 +511,11 @@ tui_gen_win_info::resize (int height_, int width_,
if (handle != nullptr)
{
#ifdef HAVE_WRESIZE
- wresize (handle, height, width);
- mvwin (handle, origin.y, origin.x);
- wmove (handle, 0, 0);
+ wresize (handle.get (), height, width);
+ mvwin (handle.get (), origin.y, origin.x);
+ wmove (handle.get (), 0, 0);
#else
- tui_delete_win (handle);
- handle = NULL;
+ handle.reset (nullptr);
#endif
}