public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Simplify varobj "change" logic
@ 2022-05-26 16:49 Tom Tromey
  2022-06-06 18:44 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Tromey @ 2022-05-26 16:49 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

varobj used to store 'print_value' as a C string, where NULL was a
valid value, and so it had logic to handle this situation.  However,
at some point this was changed to be a std::string, and so the code
can be simplified in this spot.
---
 gdb/varobj.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/gdb/varobj.c b/gdb/varobj.c
index 741fdb6a03b..1aca015a21a 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -1344,11 +1344,8 @@ install_new_value (struct varobj *var, struct value *value, bool initial)
     {
       print_value = varobj_value_get_print_value (var->value.get (),
 						  var->format, var);
-      if ((var->print_value.empty () && !print_value.empty ())
-	  || (!var->print_value.empty () && print_value.empty ())
-	  || (!var->print_value.empty () && !print_value.empty ()
-	      && var->print_value != print_value))
-	  changed = true;
+      if (var->print_value != print_value)
+	changed = true;
     }
   var->print_value = print_value;
 
-- 
2.34.1


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

* Re: [PATCH] Simplify varobj "change" logic
  2022-05-26 16:49 [PATCH] Simplify varobj "change" logic Tom Tromey
@ 2022-06-06 18:44 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2022-06-06 18:44 UTC (permalink / raw)
  To: Tom Tromey via Gdb-patches; +Cc: Tom Tromey

>>>>> "Tom" == Tom Tromey via Gdb-patches <gdb-patches@sourceware.org> writes:

Tom> varobj used to store 'print_value' as a C string, where NULL was a
Tom> valid value, and so it had logic to handle this situation.  However,
Tom> at some point this was changed to be a std::string, and so the code
Tom> can be simplified in this spot.

I'm going to check this in shortly.

Tom

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

end of thread, other threads:[~2022-06-06 18:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-26 16:49 [PATCH] Simplify varobj "change" logic Tom Tromey
2022-06-06 18:44 ` Tom Tromey

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