[05/14] Remove tui_register_info::visible
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 |
success
|
Testing passed
|
Commit Message
tui_register_info::visible is redundant with the fact that y==0 means
that the register is not visible -- and some spots already check the
latter. This patch removes this member in favor of having a single
indication of the register's visibility. This change makes it clear
that delete_data_content_windows is not needed, so this is removed as
well.
---
gdb/tui/tui-regs.c | 15 +--------------
gdb/tui/tui-regs.h | 1 -
2 files changed, 1 insertion(+), 15 deletions(-)
Comments
Am Sonntag, 17. Dezember 2023, 20:51:14 MEZ hat Tom Tromey <tom@tromey.com> Folgendes geschrieben:
> tui_register_info::visible is redundant with the fact that y==0 means
> that the register is not visible -- and some spots already check the
> latter. This patch removes this member in favor of having a single
> indication of the register's visibility. This change makes it clear
> that delete_data_content_windows is not needed, so this is removed as
> well.
> ---
> gdb/tui/tui-regs.c | 15 +--------------
> gdb/tui/tui-regs.h | 1 -
> 2 files changed, 1 insertion(+), 15 deletions(-)
>
> diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
> index f87d1ff8721..9108e460d6f 100644
> --- a/gdb/tui/tui-regs.c
> +++ b/gdb/tui/tui-regs.c
> @@ -269,7 +269,6 @@ tui_data_window::display_registers_from (int start_element_no)
> /* Create the window if necessary. */
> m_regs_content[i].x = box_width () + (m_item_width * j);
> m_regs_content[i].y = cur_y;
> - m_regs_content[i].visible = true;
> m_regs_content[i].rerender (handle.get (), m_item_width);
> i++; /* Next register. */
> }
> @@ -347,23 +346,13 @@ tui_data_window::first_data_item_displayed ()
> {
> for (int i = 0; i < m_regs_content.size (); i++)
> {
> - if (m_regs_content[i].visible)
> + if (m_regs_content[i].y > 0)
> return i;
> }
>
> return -1;
> }
>
> -/* See tui-regs.h. */
> -
> -void
> -tui_data_window::delete_data_content_windows ()
> -{
> - for (auto &win : m_regs_content)
> - win.visible = false;
>
> -}
> -
> -
> void
>
> tui_data_window::erase_data_content (const char *prompt)
> {
> @@ -401,7 +390,6 @@ tui_data_window::rerender (bool toplevel)
> else
> {
> erase_data_content (NULL);
> - delete_data_content_windows ();
> display_registers_from (0);
> }
> }
> @@ -426,7 +414,6 @@ tui_data_window::do_scroll_vertical (int num_to_scroll)
> {
> first_line += num_to_scroll;
> erase_data_content (NULL);
> - delete_data_content_windows ();
> display_registers_from_line (first_line);
> }
> }
> diff --git a/gdb/tui/tui-regs.h b/gdb/tui/tui-regs.h
> index 1a9f30fa270..701b8707947 100644
> --- a/gdb/tui/tui-regs.h
> +++ b/gdb/tui/tui-regs.h
> @@ -50,7 +50,6 @@ struct tui_register_info
> /* The register number. */
> int regno;
> bool highlight = false;
> - bool visible = false;
> std::string content;
> };
>
>
> --
> 2.43.0
I think you missed removing tui_data_window::delete_data_content_windows
from tui-regs.h.
Regards
Hannes
Tom Tromey <tom@tromey.com> writes:
> tui_register_info::visible is redundant with the fact that y==0 means
> that the register is not visible -- and some spots already check the
> latter.
I'm not sure moving to 'y > 0' is an improvement though...
Would a better solution be to change the visible to a member function,
defined in the header file (so it can inline)?
Thanks,
Andrew
> This patch removes this member in favor of having a single
> indication of the register's visibility. This change makes it clear
> that delete_data_content_windows is not needed, so this is removed as
> well.
> ---
> gdb/tui/tui-regs.c | 15 +--------------
> gdb/tui/tui-regs.h | 1 -
> 2 files changed, 1 insertion(+), 15 deletions(-)
>
> diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
> index f87d1ff8721..9108e460d6f 100644
> --- a/gdb/tui/tui-regs.c
> +++ b/gdb/tui/tui-regs.c
> @@ -269,7 +269,6 @@ tui_data_window::display_registers_from (int start_element_no)
> /* Create the window if necessary. */
> m_regs_content[i].x = box_width () + (m_item_width * j);
> m_regs_content[i].y = cur_y;
> - m_regs_content[i].visible = true;
> m_regs_content[i].rerender (handle.get (), m_item_width);
> i++; /* Next register. */
> }
> @@ -347,23 +346,13 @@ tui_data_window::first_data_item_displayed ()
> {
> for (int i = 0; i < m_regs_content.size (); i++)
> {
> - if (m_regs_content[i].visible)
> + if (m_regs_content[i].y > 0)
> return i;
> }
>
> return -1;
> }
>
> -/* See tui-regs.h. */
> -
> -void
> -tui_data_window::delete_data_content_windows ()
> -{
> - for (auto &win : m_regs_content)
> - win.visible = false;
> -}
> -
> -
> void
> tui_data_window::erase_data_content (const char *prompt)
> {
> @@ -401,7 +390,6 @@ tui_data_window::rerender (bool toplevel)
> else
> {
> erase_data_content (NULL);
> - delete_data_content_windows ();
> display_registers_from (0);
> }
> }
> @@ -426,7 +414,6 @@ tui_data_window::do_scroll_vertical (int num_to_scroll)
> {
> first_line += num_to_scroll;
> erase_data_content (NULL);
> - delete_data_content_windows ();
> display_registers_from_line (first_line);
> }
> }
> diff --git a/gdb/tui/tui-regs.h b/gdb/tui/tui-regs.h
> index 1a9f30fa270..701b8707947 100644
> --- a/gdb/tui/tui-regs.h
> +++ b/gdb/tui/tui-regs.h
> @@ -50,7 +50,6 @@ struct tui_register_info
> /* The register number. */
> int regno;
> bool highlight = false;
> - bool visible = false;
> std::string content;
> };
>
>
> --
> 2.43.0
>>>>> "Hannes" == Hannes Domani <ssbssa@yahoo.de> writes:
Hannes> Am Sonntag, 17. Dezember 2023, 20:51:14 MEZ hat Tom Tromey <tom@tromey.com> Folgendes geschrieben:
>> tui_register_info::visible is redundant with the fact that y==0 means
>> that the register is not visible -- and some spots already check the
>> latter. This patch removes this member in favor of having a single
>> indication of the register's visibility. This change makes it clear
>> that delete_data_content_windows is not needed, so this is removed as
>> well.
Hannes> I think you missed removing tui_data_window::delete_data_content_windows
Hannes> from tui-regs.h.
Thanks, I fixed this.
Tom
>> tui_register_info::visible is redundant with the fact that y==0 means
>> that the register is not visible -- and some spots already check the
>> latter.
Andrew> I'm not sure moving to 'y > 0' is an improvement though...
Andrew> Would a better solution be to change the visible to a member function,
Andrew> defined in the header file (so it can inline)?
I made this change.
Tom
@@ -269,7 +269,6 @@ tui_data_window::display_registers_from (int start_element_no)
/* Create the window if necessary. */
m_regs_content[i].x = box_width () + (m_item_width * j);
m_regs_content[i].y = cur_y;
- m_regs_content[i].visible = true;
m_regs_content[i].rerender (handle.get (), m_item_width);
i++; /* Next register. */
}
@@ -347,23 +346,13 @@ tui_data_window::first_data_item_displayed ()
{
for (int i = 0; i < m_regs_content.size (); i++)
{
- if (m_regs_content[i].visible)
+ if (m_regs_content[i].y > 0)
return i;
}
return -1;
}
-/* See tui-regs.h. */
-
-void
-tui_data_window::delete_data_content_windows ()
-{
- for (auto &win : m_regs_content)
- win.visible = false;
-}
-
-
void
tui_data_window::erase_data_content (const char *prompt)
{
@@ -401,7 +390,6 @@ tui_data_window::rerender (bool toplevel)
else
{
erase_data_content (NULL);
- delete_data_content_windows ();
display_registers_from (0);
}
}
@@ -426,7 +414,6 @@ tui_data_window::do_scroll_vertical (int num_to_scroll)
{
first_line += num_to_scroll;
erase_data_content (NULL);
- delete_data_content_windows ();
display_registers_from_line (first_line);
}
}
@@ -50,7 +50,6 @@ struct tui_register_info
/* The register number. */
int regno;
bool highlight = false;
- bool visible = false;
std::string content;
};