From c398c3d0b56823bb12718ae46a8c273b866ca246 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 6 Jul 2019 16:17:46 -0600 Subject: [PATCH] Remove tui_clear_source_content tui_clear_source_content is not needed. Instead, the callers can call erase_source_content, which is also changed to clear the content vector. gdb/ChangeLog 2019-08-15 Tom Tromey * tui/tui-winsource.h (tui_clear_source_content): Don't declare. * tui/tui-winsource.c (tui_update_source_window_as_is): Don't call tui_clear_source_content. (tui_clear_source_content): Remove. (tui_source_window_base::do_erase_source_content): Hoist call to content.clear(). * tui/tui-stack.c (tui_show_frame_info): Don't call tui_clear_source_content. --- gdb/ChangeLog | 11 +++++++++++ gdb/tui/tui-stack.c | 2 +- gdb/tui/tui-winsource.c | 25 +++---------------------- gdb/tui/tui-winsource.h | 1 - 4 files changed, 15 insertions(+), 24 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f109f9a35f3..b3d3028fc5c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,14 @@ +2019-08-15 Tom Tromey + + * tui/tui-winsource.h (tui_clear_source_content): Don't declare. + * tui/tui-winsource.c (tui_update_source_window_as_is): Don't call + tui_clear_source_content. + (tui_clear_source_content): Remove. + (tui_source_window_base::do_erase_source_content): Hoist call to + content.clear(). + * tui/tui-stack.c (tui_show_frame_info): Don't call + tui_clear_source_content. + 2019-08-15 Tom Tromey * tui/tui-winsource.h (struct tui_source_window_base) diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c index 09ee87f4027..f61aa526004 100644 --- a/gdb/tui/tui-stack.c +++ b/gdb/tui/tui-stack.c @@ -411,7 +411,7 @@ tui_show_frame_info (struct frame_info *fi) tui_show_locator_content (); for (struct tui_source_window_base *win_info : tui_source_windows ()) { - tui_clear_source_content (win_info); + win_info->erase_source_content (); win_info->update_exec_info (); } diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index d955efcd575..95a2ac27094 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -98,7 +98,7 @@ tui_update_source_window_as_is (struct tui_source_window_base *win_info, ret = tui_set_disassem_content (win_info, gdbarch, line_or_addr.u.addr); if (ret == TUI_FAILURE) - tui_clear_source_content (win_info); + win_info->erase_source_content (); else { tui_update_breakpoint_info (win_info, nullptr, false); @@ -153,7 +153,7 @@ tui_update_source_windows_with_addr (struct gdbarch *gdbarch, CORE_ADDR addr) else { for (struct tui_source_window_base *win_info : tui_source_windows ()) - tui_clear_source_content (win_info); + win_info->erase_source_content (); } } @@ -191,31 +191,13 @@ tui_update_source_windows_with_line (struct symtab *s, int line) } } -void -tui_clear_source_content (struct tui_source_window_base *win_info) -{ - if (win_info != NULL) - { - int i; - - win_info->erase_source_content (); - for (i = 0; i < win_info->content.size (); i++) - { - struct tui_source_element *element = &win_info->content[i]; - - element->break_mode = 0; - element->is_exec_point = false; - } - } -} - - void tui_source_window_base::do_erase_source_content (const char *str) { int x_pos; int half_width = (width - 2) / 2; + content.clear (); if (handle != NULL) { werase (handle); @@ -230,7 +212,6 @@ tui_source_window_base::do_erase_source_content (const char *str) x_pos, (char *) str); - content.clear (); refresh_window (); werase (execution_info->handle); diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h index 0443c4a3c4d..e7ae5b0abc3 100644 --- a/gdb/tui/tui-winsource.h +++ b/gdb/tui/tui-winsource.h @@ -187,7 +187,6 @@ extern void tui_update_source_window_as_is (struct tui_source_window_base *, extern void tui_update_source_windows_with_addr (struct gdbarch *, CORE_ADDR); extern void tui_update_source_windows_with_line (struct symtab *, int); -extern void tui_clear_source_content (struct tui_source_window_base *); /* Constant definitions. */ #define SCROLL_THRESHOLD 2 /* Threshold for lazy scroll. */ -- 2.30.2