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: [OB] cli/cli-script.c, null ptr guard


> On Thu, Jun 28, 2007 at 03:17:18PM -0700, msnyder@sonic.net wrote:
>> > No, I don't think this is obvious.  What does it mean to have a null
>> > string here and how can it happen?  I'm pretty sure it can't, and the
>> > if check is just clutter.
>>
>> The reasoning is that, since we checked it for NULL in the
>> first statement of the function, we must believe that the
>> possibility exists for it to be NULL.
>
> Right.  So, is it a sensible check?  Or should it be removed, or
> should the condition for the error be simplified?

Well, it either makes sense to check it for null, or it doesn't.
If the new test is redundant, so is the old one.  Whoever wrote
it in the first place seemed to think it was worth checking.

This is called from a number of places, but they are all local to the module.

Ultimately the argument comes from the command parser.
It's one of those typical (char *args, int from_tty) things.

I've never been sure whether those were guaranteed to be non-null, or not.




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