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: [PATCH v2 02/31] cli/cli-script.c: Remove some dead NULL checks


On 10/19/2016 06:24 PM, Simon Marchi wrote:
> On 2016-10-18 21:11, Pedro Alves wrote:
>> @@ -853,8 +845,6 @@ insert_args (char *line)
>>
>>    /* Allocate space for the new line and fill it in.  */
>>    new_line = (char *) xmalloc (len + 1);
>> -  if (new_line == NULL)
>> -    return NULL;
>>
>>    /* Restore pointer to beginning of old line.  */
>>    line = save_line;
> 
> A few lines higher in insert_args, there is:
> 
>     error (_("Missing argument %d in user function."), i);
>     return NULL;
> 
> That return NULL is also dead code and could be confusing, leading
> someone to think insert_args can return NULL.  I think you could remove
> it at the same time.

Ah.  Guess I missed it because that code disappears with patch
(patch #4).   I wrote patches #2-#4 as a single patch, and
then missed that when I split them to ease review...  :-)

I've changed this locally.

Thanks,
Pedro Alves


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