This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]