public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [COMMITTED PATCH] value_maybe_namespace_elt: Remove unnecessary test of result != NULL.
@ 2014-12-13  7:30 Doug Evans
  0 siblings, 0 replies; only message in thread
From: Doug Evans @ 2014-12-13  7:30 UTC (permalink / raw)
  To: gdb-patches

Hi.

I happened to notice this while reading the code,
and then studied both allocate_value and value_of_variable.
They are guaranteed to return non-NULL, so testing result != NULL
is unnecessary.

Regression tested on amd64-linux.

2014-12-12  Doug Evans  <xdje42@gmail.com>

	* valops.c (value_maybe_namespace_elt): Remove unnecessary test of
	result != NULL.

diff --git a/gdb/valops.c b/gdb/valops.c
index 4125fc0..4d3059e 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -3586,7 +3586,7 @@ value_maybe_namespace_elt (const struct type *curtype,
   else
     result = value_of_variable (sym, get_selected_block (0));
 
-  if (result && want_address)
+  if (want_address)
     result = value_addr (result);
 
   return result;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-12-13  7:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-13  7:30 [COMMITTED PATCH] value_maybe_namespace_elt: Remove unnecessary test of result != NULL Doug Evans

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