This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[COMMITTED PATCH] value_maybe_namespace_elt: Remove unnecessary test of result != NULL.
- From: Doug Evans <xdje42 at gmail dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 12 Dec 2014 23:29:31 -0800
- Subject: [COMMITTED PATCH] value_maybe_namespace_elt: Remove unnecessary test of result != NULL.
- Authentication-results: sourceware.org; auth=none
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;