Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Burgess <andrew.burgess@embecosm.com>
To: gdb-patches@sourceware.org
Cc: Andrew Burgess <andrew.burgess@embecosm.com>
Subject: [PATCH] gdb/tui: Don't cast between window types.
Date: Mon, 06 Jul 2015 16:18:00 -0000	[thread overview]
Message-ID: <e46e2224ac1079efed5e9d9ad5be54c9893f39d9.1436199276.git.andrew.burgess@embecosm.com> (raw)

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(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4636653..13d6da9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index feb360b..629d54d 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -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);
-- 
2.4.0


             reply	other threads:[~2015-07-06 16:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-06 16:18 Andrew Burgess [this message]
2015-07-06 16:21 ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e46e2224ac1079efed5e9d9ad5be54c9893f39d9.1436199276.git.andrew.burgess@embecosm.com \
    --to=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox