Re: [PATCH 15/18] -Wwrite-strings: execute_command calls with string literals

Pedro Alves
2017-04-05T13:10:34Z

On 04/05/2017 08:13 AM, Metzger, Markus T wrote:

> The patch looks good to me. But I'm wondering if we should instead change
> execute_command to take a const char *.

That's not that simple, because some commands do want to modify the
input string.

For example, cli/cli-cmds.c:list_command does:

/* If this command is repeated with RET,
turn it into the no-arg variant. */

if (from_tty)
*arg = 0;

and also, it'd require a lot of cascading constification
inside many commands, because lots of command args processing
passes "&args" to some routine that expects a "char **".

Thanks,
Pedro Alves