[COMMITTED] value_maybe_namespace_elt: Remove unnecessary test of result != NULL.

Message ID m3oar8husk.fsf@seba.sebabeach.org
State Committed
Headers

Commit Message

Doug Evans Dec. 13, 2014, 7:29 a.m. UTC
  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.
  

Patch

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;