diff options
author | Tom Tromey <tom@tromey.com> | 2019-07-06 16:17:46 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2019-08-15 12:29:28 -0600 |
commit | c398c3d0b56823bb12718ae46a8c273b866ca246 (patch) | |
tree | 5e336430add83449e6b5ef7ca36195295faf2277 /gdb | |
parent | e25d200487dba7dfdf92f638e4ef2aefd7bd7481 (diff) | |
download | gdb-c398c3d0b56823bb12718ae46a8c273b866ca246.zip gdb-c398c3d0b56823bb12718ae46a8c273b866ca246.tar.gz gdb-c398c3d0b56823bb12718ae46a8c273b866ca246.tar.bz2 |
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 <tom@tromey.com>
* 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.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 11 | ||||
-rw-r--r-- | gdb/tui/tui-stack.c | 2 | ||||
-rw-r--r-- | gdb/tui/tui-winsource.c | 25 | ||||
-rw-r--r-- | gdb/tui/tui-winsource.h | 1 |
4 files changed, 15 insertions, 24 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f109f9a..b3d3028 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,16 @@ 2019-08-15 Tom Tromey <tom@tromey.com> + * 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 <tom@tromey.com> + * tui/tui-winsource.h (struct tui_source_window_base) <do_erase_source_content>: New method. <erase_source_content>: New method. diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c index 09ee87f..f61aa52 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 d955efc..95a2ac2 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 (); } } @@ -192,30 +192,12 @@ 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 0443c4a..e7ae5b0 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. */ |