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.


>   No, I think that the code relies on the fact that physname
> is never null, but that the constructor or destructor could have no
> parameters, in which case  physname would point to \0
> after the '+= 6'.

OK, we agree, in fact:

> Is this correct:
>    if (physname && (*physname != 0))
> or is:
>    if (physname && *physname != 0)
> 
> better?
> or should I use:
>    if (physname && *physname != '\0')

My suggestion was to remove the "physname [!= NULL]" part only.
Hence:

    if (*physname != '\0')

(I think we have more cases of '\0' than 0 when we're checking
character values)

-- 
Joel


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