public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] Introduce tui_data_window::first_reg_element_no_inline
Date: Wed, 17 Jul 2019 18:37:00 -0000	[thread overview]
Message-ID: <20190717183707.61028.qmail@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=baff0c28b83bd1ad7949d07b78fdb85ad6be49a5

commit baff0c28b83bd1ad7949d07b78fdb85ad6be49a5
Author: Tom Tromey <tom@tromey.com>
Date:   Wed Jun 26 15:49:00 2019 -0600

    Introduce tui_data_window::first_reg_element_no_inline
    
    This changes tui_first_reg_element_no_inline to be a method on
    tui_data_window.  This again moves uses of the TUI_DATA_WIN global
    from this function into other functions that are already using the
    global.
    
    gdb/ChangeLog
    2019-07-17  Tom Tromey  <tom@tromey.com>
    
    	* tui/tui-regs.h (tui_first_reg_element_no_inline): Don't
    	declare.
    	* tui/tui-regs.c (tui_data_window::first_reg_element_no_inline):
    	Rename from tui_first_reg_element_no_inline.
    	(tui_display_reg_element_at_line)
    	(tui_display_registers_from_line): Update.
    	* tui/tui-data.h (struct tui_data_window)
    	<first_reg_element_no_inline>: New method.

Diff:
---
 gdb/ChangeLog      | 11 +++++++++++
 gdb/tui/tui-data.h |  4 ++++
 gdb/tui/tui-regs.c | 16 +++++++---------
 gdb/tui/tui-regs.h |  1 -
 4 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9177dfd..813c86d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,16 @@
 2019-07-17  Tom Tromey  <tom@tromey.com>
 
+	* tui/tui-regs.h (tui_first_reg_element_no_inline): Don't
+	declare.
+	* tui/tui-regs.c (tui_data_window::first_reg_element_no_inline):
+	Rename from tui_first_reg_element_no_inline.
+	(tui_display_reg_element_at_line)
+	(tui_display_registers_from_line): Update.
+	* tui/tui-data.h (struct tui_data_window)
+	<first_reg_element_no_inline>: New method.
+
+2019-07-17  Tom Tromey  <tom@tromey.com>
+
 	* tui/tui-windata.c (tui_display_data_from)
 	(tui_data_window::do_scroll_vertical): Update.
 	* tui/tui-regs.h (tui_line_from_reg_element_no): Don't declare.
diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h
index 081d0df..676345c 100644
--- a/gdb/tui/tui-data.h
+++ b/gdb/tui/tui-data.h
@@ -499,6 +499,10 @@ struct tui_data_window : public tui_win_info
      elements there are, -1 is returned.  */
   int line_from_reg_element_no (int element_no) const;
 
+  /* Answer the index of the first element in line_no.  If line_no is
+     past the register area (-1) is returned.  */
+  int first_reg_element_no_inline (int line_no) const;
+
 protected:
 
   void do_scroll_vertical (int num_to_scroll) override;
diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index 03e9149..d005fe3 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -103,16 +103,13 @@ tui_data_window::line_from_reg_element_no (int element_no) const
     return (-1);
 }
 
+/* See tui-data.h.  */
 
-/* Answer the index of the first element in line_no.  If line_no is
-   past the register area (-1) is returned.  */
 int
-tui_first_reg_element_no_inline (int line_no)
+tui_data_window::first_reg_element_no_inline (int line_no) const
 {
-  if ((line_no * TUI_DATA_WIN->regs_column_count)
-      <= TUI_DATA_WIN->regs_content.size ())
-    return (((line_no + 1) * TUI_DATA_WIN->regs_column_count) 
-	    - TUI_DATA_WIN->regs_column_count);
+  if (line_no * regs_column_count <= regs_content.size ())
+    return ((line_no + 1) * regs_column_count) - regs_column_count;
   else
     return (-1);
 }
@@ -362,7 +359,8 @@ tui_display_reg_element_at_line (int start_element_no,
 	     display at.  */
 	  if (start_line_no > first_line_on_last_page)
 	    element_no
-	      = tui_first_reg_element_no_inline (first_line_on_last_page);
+	      = (TUI_DATA_WIN->first_reg_element_no_inline
+		 (first_line_on_last_page));
 	}
       tui_display_registers_from (element_no);
     }
@@ -399,7 +397,7 @@ tui_display_registers_from_line (int line_no,
       else
 	line = line_no;
 
-      element_no = tui_first_reg_element_no_inline (line);
+      element_no = TUI_DATA_WIN->first_reg_element_no_inline (line);
       if (element_no < TUI_DATA_WIN->regs_content.size ())
 	tui_display_reg_element_at_line (element_no, line);
       else
diff --git a/gdb/tui/tui-regs.h b/gdb/tui/tui-regs.h
index f6ed862..866af45 100644
--- a/gdb/tui/tui-regs.h
+++ b/gdb/tui/tui-regs.h
@@ -29,6 +29,5 @@ extern void tui_show_registers (struct reggroup *group);
 extern void tui_display_registers_from (int);
 extern int tui_display_registers_from_line (int, int);
 extern int tui_first_reg_element_inline (int);
-extern int tui_first_reg_element_no_inline (int lineno);
 
 #endif /* TUI_TUI_REGS_H */


                 reply	other threads:[~2019-07-17 18:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20190717183707.61028.qmail@sourceware.org \
    --to=tromey@sourceware.org \
    --cc=gdb-cvs@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).