gdb/tui: Don't cast between window types.
Commit Message
I'll push the following patch as obvious in a couple of days if no one
objects.
Though the existing code is currently fine, I think the new version is
clearer and more robust.
OK to apply?
Thanks,
Andrew
---
Instead of casting between structure types to get the 'tui_gen_win_info'
info from a 'tui_win_info' access the generic member variable. This is
inline with what is done throughout the rest of the tui code.
gdb/ChangeLog:
* tui/tui-win.c (tui_set_focus): Use structure member 'generic'
instead of casting the structure type.
---
gdb/ChangeLog | 5 +++++
gdb/tui/tui-win.c | 3 +--
2 files changed, 6 insertions(+), 2 deletions(-)
Comments
On 07/06/2015 05:17 PM, Andrew Burgess wrote:
> I'll push the following patch as obvious in a couple of days if no one
> objects.
>
> Though the existing code is currently fine, I think the new version is
> clearer and more robust.
>
> OK to apply?
Yes, please go ahead.
Thanks,
Pedro Alves
@@ -1,5 +1,10 @@
2015-07-06 Andrew Burgess <andrew.burgess@embecosm.com>
+ * tui/tui-win.c (tui_set_focus): Use structure member 'generic'
+ instead of casting the structure type.
+
+2015-07-06 Andrew Burgess <andrew.burgess@embecosm.com>
+
* tui/tui-data.c (tui_partial_win_by_name): Window name is const.
(tui_win_name): Make parameter and result const.
* tui/tui-data.h (tui_win_name): Make parameter and result const.
@@ -1059,8 +1059,7 @@ The window name specified must be valid and visible.\n"));
tui_refresh_data_win ();
xfree (buf_ptr);
printf_filtered (_("Focus set to %s window.\n"),
- tui_win_name ((struct tui_gen_win_info *)
- tui_win_with_focus ()));
+ tui_win_name (&tui_win_with_focus ()->generic));
}
else
warning (_("Incorrect Number of Arguments.\n%s"), FOCUS_USAGE);