public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [review] Simplify tui_update_source_windows_with_addr
@ 2019-11-14 23:41 Tom Tromey (Code Review)
  2019-12-12  2:35 ` [review v2] " Tom Tromey (Code Review)
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tom Tromey (Code Review) @ 2019-11-14 23:41 UTC (permalink / raw)
  To: gdb-patches

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/641
......................................................................

Simplify tui_update_source_windows_with_addr

After the previous changes, tui_update_source_windows_with_addr simply
updates each source-like window separately, passing the same data to
each.  So, it can be simplified by using a loop instead.

gdb/ChangeLog
2019-11-14  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.c (tui_update_source_windows_with_addr):
	Simplify.

Change-Id: Id2ba6b3145ec005dbed1b1115118bd1ef4efb842
---
M gdb/ChangeLog
M gdb/tui/tui-winsource.c
2 files changed, 9 insertions(+), 13 deletions(-)



diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1bc528d..358a90f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
 2019-11-14  Tom Tromey  <tom@tromey.com>
 
+	* tui/tui-winsource.c (tui_update_source_windows_with_addr):
+	Simplify.
+
+2019-11-14  Tom Tromey  <tom@tromey.com>
+
 	* tui/tui-winsource.h (struct tui_source_window_base)
 	<set_contents, update_source_window_as_is, update_source_window>:
 	Take a sal, not a separate symtab and tui_line_or_address.
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 0039f96..e1b19cd 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -199,21 +199,12 @@
 void
 tui_update_source_windows_with_addr (struct gdbarch *gdbarch, CORE_ADDR addr)
 {
+  struct symtab_and_line sal {};
   if (addr != 0)
-    {
-      struct symtab_and_line sal = find_pc_line (addr, 0);
-      
-      if (TUI_DISASM_WIN != nullptr)
-	TUI_DISASM_WIN->update_source_window (gdbarch, sal);
+    sal = find_pc_line (addr, 0);
 
-      if (TUI_SRC_WIN != nullptr)
-	TUI_SRC_WIN->update_source_window (gdbarch, sal);
-    }
-  else
-    {
-      for (struct tui_source_window_base *win_info : tui_source_windows ())
-	win_info->erase_source_content ();
-    }
+  for (struct tui_source_window_base *win_info : tui_source_windows ())
+    win_info->update_source_window (gdbarch, sal);
 }
 
 /* Function to ensure that the source and/or disassemly windows

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Id2ba6b3145ec005dbed1b1115118bd1ef4efb842
Gerrit-Change-Number: 641
Gerrit-PatchSet: 1
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newchange

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [review v2] Simplify tui_update_source_windows_with_addr
  2019-11-14 23:41 [review] Simplify tui_update_source_windows_with_addr Tom Tromey (Code Review)
@ 2019-12-12  2:35 ` Tom Tromey (Code Review)
  2019-12-20 16:20 ` [pushed] " Sourceware to Gerrit sync (Code Review)
  2019-12-20 16:38 ` Sourceware to Gerrit sync (Code Review)
  2 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey (Code Review) @ 2019-12-12  2:35 UTC (permalink / raw)
  To: gdb-patches

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/641
......................................................................

Simplify tui_update_source_windows_with_addr

After the previous changes, tui_update_source_windows_with_addr simply
updates each source-like window separately, passing the same data to
each.  So, it can be simplified by using a loop instead.

2019-12-11  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.c (tui_update_source_windows_with_addr):
	Simplify.

Change-Id: Id2ba6b3145ec005dbed1b1115118bd1ef4efb842
---
M gdb/ChangeLog
M gdb/tui/tui-winsource.c
2 files changed, 9 insertions(+), 13 deletions(-)



diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index cd8f440..56a53ef 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
 2019-12-11  Tom Tromey  <tom@tromey.com>
 
+	* tui/tui-winsource.c (tui_update_source_windows_with_addr):
+	Simplify.
+
+2019-12-11  Tom Tromey  <tom@tromey.com>
+
 	* tui/tui-winsource.h (struct tui_source_window_base)
 	<set_contents, update_source_window_as_is, update_source_window>:
 	Take a sal, not a separate symtab and tui_line_or_address.
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index cad7dea..8f98904 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -206,21 +206,12 @@
 void
 tui_update_source_windows_with_addr (struct gdbarch *gdbarch, CORE_ADDR addr)
 {
+  struct symtab_and_line sal {};
   if (addr != 0)
-    {
-      struct symtab_and_line sal = find_pc_line (addr, 0);
-      
-      if (TUI_DISASM_WIN != nullptr)
-	TUI_DISASM_WIN->update_source_window (gdbarch, sal);
+    sal = find_pc_line (addr, 0);
 
-      if (TUI_SRC_WIN != nullptr)
-	TUI_SRC_WIN->update_source_window (gdbarch, sal);
-    }
-  else
-    {
-      for (struct tui_source_window_base *win_info : tui_source_windows ())
-	win_info->erase_source_content ();
-    }
+  for (struct tui_source_window_base *win_info : tui_source_windows ())
+    win_info->update_source_window (gdbarch, sal);
 }
 
 /* Function to ensure that the source and/or disassemly windows

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Id2ba6b3145ec005dbed1b1115118bd1ef4efb842
Gerrit-Change-Number: 641
Gerrit-PatchSet: 2
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newpatchset

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pushed] Simplify tui_update_source_windows_with_addr
  2019-11-14 23:41 [review] Simplify tui_update_source_windows_with_addr Tom Tromey (Code Review)
  2019-12-12  2:35 ` [review v2] " Tom Tromey (Code Review)
@ 2019-12-20 16:20 ` Sourceware to Gerrit sync (Code Review)
  2019-12-20 16:38 ` Sourceware to Gerrit sync (Code Review)
  2 siblings, 0 replies; 4+ messages in thread
From: Sourceware to Gerrit sync (Code Review) @ 2019-12-20 16:20 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

Sourceware to Gerrit sync has submitted this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/641
......................................................................

Simplify tui_update_source_windows_with_addr

After the previous changes, tui_update_source_windows_with_addr simply
updates each source-like window separately, passing the same data to
each.  So, it can be simplified by using a loop instead.

gdb/ChangeLog
2019-12-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.c (tui_update_source_windows_with_addr):
	Simplify.

Change-Id: Id2ba6b3145ec005dbed1b1115118bd1ef4efb842
---
M gdb/ChangeLog
M gdb/tui/tui-winsource.c
2 files changed, 9 insertions(+), 13 deletions(-)


diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index feb406b..77620d0 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
 2019-12-20  Tom Tromey  <tom@tromey.com>
 
+	* tui/tui-winsource.c (tui_update_source_windows_with_addr):
+	Simplify.
+
+2019-12-20  Tom Tromey  <tom@tromey.com>
+
 	* tui/tui-winsource.h (struct tui_source_window_base)
 	<set_contents, update_source_window_as_is, update_source_window>:
 	Take a sal, not a separate symtab and tui_line_or_address.
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index cad7dea..8f98904 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -206,21 +206,12 @@
 void
 tui_update_source_windows_with_addr (struct gdbarch *gdbarch, CORE_ADDR addr)
 {
+  struct symtab_and_line sal {};
   if (addr != 0)
-    {
-      struct symtab_and_line sal = find_pc_line (addr, 0);
-      
-      if (TUI_DISASM_WIN != nullptr)
-	TUI_DISASM_WIN->update_source_window (gdbarch, sal);
+    sal = find_pc_line (addr, 0);
 
-      if (TUI_SRC_WIN != nullptr)
-	TUI_SRC_WIN->update_source_window (gdbarch, sal);
-    }
-  else
-    {
-      for (struct tui_source_window_base *win_info : tui_source_windows ())
-	win_info->erase_source_content ();
-    }
+  for (struct tui_source_window_base *win_info : tui_source_windows ())
+    win_info->update_source_window (gdbarch, sal);
 }
 
 /* Function to ensure that the source and/or disassemly windows

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Id2ba6b3145ec005dbed1b1115118bd1ef4efb842
Gerrit-Change-Number: 641
Gerrit-PatchSet: 3
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: merged

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pushed] Simplify tui_update_source_windows_with_addr
  2019-11-14 23:41 [review] Simplify tui_update_source_windows_with_addr Tom Tromey (Code Review)
  2019-12-12  2:35 ` [review v2] " Tom Tromey (Code Review)
  2019-12-20 16:20 ` [pushed] " Sourceware to Gerrit sync (Code Review)
@ 2019-12-20 16:38 ` Sourceware to Gerrit sync (Code Review)
  2 siblings, 0 replies; 4+ messages in thread
From: Sourceware to Gerrit sync (Code Review) @ 2019-12-20 16:38 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

The original change was created by Tom Tromey.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/641
......................................................................

Simplify tui_update_source_windows_with_addr

After the previous changes, tui_update_source_windows_with_addr simply
updates each source-like window separately, passing the same data to
each.  So, it can be simplified by using a loop instead.

gdb/ChangeLog
2019-12-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.c (tui_update_source_windows_with_addr):
	Simplify.

Change-Id: Id2ba6b3145ec005dbed1b1115118bd1ef4efb842
---
M gdb/ChangeLog
M gdb/tui/tui-winsource.c
2 files changed, 9 insertions(+), 13 deletions(-)



diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index feb406b..77620d0 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
 2019-12-20  Tom Tromey  <tom@tromey.com>
 
+	* tui/tui-winsource.c (tui_update_source_windows_with_addr):
+	Simplify.
+
+2019-12-20  Tom Tromey  <tom@tromey.com>
+
 	* tui/tui-winsource.h (struct tui_source_window_base)
 	<set_contents, update_source_window_as_is, update_source_window>:
 	Take a sal, not a separate symtab and tui_line_or_address.
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index cad7dea..8f98904 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -206,21 +206,12 @@
 void
 tui_update_source_windows_with_addr (struct gdbarch *gdbarch, CORE_ADDR addr)
 {
+  struct symtab_and_line sal {};
   if (addr != 0)
-    {
-      struct symtab_and_line sal = find_pc_line (addr, 0);
-      
-      if (TUI_DISASM_WIN != nullptr)
-	TUI_DISASM_WIN->update_source_window (gdbarch, sal);
+    sal = find_pc_line (addr, 0);
 
-      if (TUI_SRC_WIN != nullptr)
-	TUI_SRC_WIN->update_source_window (gdbarch, sal);
-    }
-  else
-    {
-      for (struct tui_source_window_base *win_info : tui_source_windows ())
-	win_info->erase_source_content ();
-    }
+  for (struct tui_source_window_base *win_info : tui_source_windows ())
+    win_info->update_source_window (gdbarch, sal);
 }
 
 /* Function to ensure that the source and/or disassemly windows

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Id2ba6b3145ec005dbed1b1115118bd1ef4efb842
Gerrit-Change-Number: 641
Gerrit-PatchSet: 3
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newpatchset

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-12-20 16:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-14 23:41 [review] Simplify tui_update_source_windows_with_addr Tom Tromey (Code Review)
2019-12-12  2:35 ` [review v2] " Tom Tromey (Code Review)
2019-12-20 16:20 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-12-20 16:38 ` Sourceware to Gerrit sync (Code Review)

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