This is the mail archive of the
mailing list for the GDB project.
Re: [RFA] completion in command definition
On 2017-01-11 11:05, Jerome Guitton wrote:
>+ struct cmd_list_element *last_line = 0;
This should be either "= NULL" or "= nullptr", but actually I don't
think it needs to be initialized.
lookup_cmd_1 does not set this parameter when it is initialized
to NULL. However, the name of the variable was a thinko. I changed it
Actually, I think you are confusing pointer and pointee. lookup_cmd_1
checks if result_list is NULL, not if *result_list is NULL. So with
your version, since result_list is not NULL (&last_line is not NULL,
it's the address of the variable) lookup_cmd_1 will set the last_line
variable. There's no harm, but since we don't care about that value
it's not useful either. I think what you want is:
cmd = lookup_cmd_1 (&cmd_name, cmdlist, NULL, 1);