This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] p-typeprint.c, move pointer use to after null-check.
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Michael Snyder <msnyder at vmware dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>, Pierre Muller <muller at ics dot u-strasbg dot fr>
- Date: Tue, 8 Mar 2011 09:10:24 +0400
- Subject: Re: [RFA] p-typeprint.c, move pointer use to after null-check.
- References: <4D6D58F2.8070207@vmware.com>
> If it's worth checking for null...
>
> OK?
>
> 2011-03-01 Michael Snyder <msnyder@vmware.com>
>
> * p-typeprint.c (pascal_type_print_method_args): Don't use
> pointer until after null-check.
I think I get the drift of the code, and ISTM that the check for NULL
might be misleading. I think that "physname" can never be null, by
virtue of how it's called. What I would do is just remove the check
against NULL (we can add a gdb_assert at the same time, which would
force us to declare the is_constructor/is_destructor variables without
initial value - no big deal).
Pierre?
A few remarks:
The function could (should?) be made static, unless I grep'ed wrong
> + if (is_constructor || is_destructor)
> + {
> + physname += 6;
> + }
Useless extra curly braces...
--
Joel