Patchwork [18/24] Remove tui_set_win_focus_to

login
register
mail settings
Submitter Tom Tromey
Date Jan. 4, 2020, 6:34 p.m.
Message ID <20200104183410.17114-19-tom@tromey.com>
Download mbox | patch
Permalink /patch/37186/
State New
Headers show

Comments

Tom Tromey - Jan. 4, 2020, 6:34 p.m.
I noticed that the TUI had two functions with similar names:
tui_set_win_focus_to and tui_set_win_with_focus.

However, the former was just an implementation detail of the latter.
So, this patch removes the former entirely, to avoid any temptation to
call it.

2020-01-04  Tom Tromey  <tom@tromey.com>

	* tui/tui-win.c (tui_set_win_focus_to): Move to tui-data.c.
	* tui/tui-data.h (tui_set_win_with_focus): Don't declare.
	* tui/tui-data.c (tui_set_win_with_focus): Remove.
	(tui_set_win_focus_to): Move from tui-win.c.

Change-Id: Idffddab773436bdf80d55480906d76b292981ef2
---
 gdb/ChangeLog      |  7 +++++++
 gdb/tui/tui-data.c | 11 ++++++++---
 gdb/tui/tui-data.h |  1 -
 gdb/tui/tui-win.c  | 15 ---------------
 4 files changed, 15 insertions(+), 19 deletions(-)

Patch

diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c
index db637d8fbe6..1d822c9090f 100644
--- a/gdb/tui/tui-data.c
+++ b/gdb/tui/tui-data.c
@@ -59,11 +59,16 @@  tui_win_with_focus (void)
 }
 
 
-/* Set the window that has the logical focus.  */
+/* Set the logical focus to win_info.  */
 void
-tui_set_win_with_focus (struct tui_win_info *win_info)
+tui_set_win_focus_to (struct tui_win_info *win_info)
 {
-  win_with_focus = win_info;
+  if (win_info != NULL)
+    {
+      tui_unhighlight_win (win_with_focus);
+      win_with_focus = win_info;
+      tui_highlight_win (win_info);
+    }
 }
 
 
diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h
index 56600926636..0583c4a5c99 100644
--- a/gdb/tui/tui-data.h
+++ b/gdb/tui/tui-data.h
@@ -244,7 +244,6 @@  extern int tui_term_width (void);
 extern void tui_set_term_width_to (int);
 extern struct tui_locator_window *tui_locator_win_info_ptr (void);
 extern struct tui_win_info *tui_win_with_focus (void);
-extern void tui_set_win_with_focus (struct tui_win_info *);
 extern bool tui_win_resized ();
 extern void tui_set_win_resized_to (bool);
 
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index f8a57732cca..1cd0878b1b9 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -452,21 +452,6 @@  tui_update_gdb_sizes (void)
 }
 
 
-/* Set the logical focus to win_info.  */
-void
-tui_set_win_focus_to (struct tui_win_info *win_info)
-{
-  if (win_info != NULL)
-    {
-      struct tui_win_info *win_with_focus = tui_win_with_focus ();
-
-      tui_unhighlight_win (win_with_focus);
-      tui_set_win_with_focus (win_info);
-      tui_highlight_win (win_info);
-    }
-}
-
-
 void
 tui_win_info::forward_scroll (int num_to_scroll)
 {