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]

Re: [RFA] p-typeprint.c, move pointer use to after null-check.


> 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


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