[PATCHv2 3/5] gdb/mi: int to bool conversion in mi_execute_cli_command

Simon Marchi simark@simark.ca
Mon Dec 13 15:54:44 GMT 2021


>  void
> -mi_execute_cli_command (const char *cmd, int args_p, const char *args)
> +mi_execute_cli_command (const char *cmd, bool args_p, const char *args)
>  {
> -  if (cmd != 0)
> +  if (cmd != nullptr)
>      {
> -      std::string run = cmd;
> +      std::string run (cmd);
>
>        if (args_p)
>  	run = run + " " + args;
> +      else
> +	gdb_assert (args == nullptr);

Alternatively, args could be changed to gdb::optional<const char *>.
LGTM in any case, and this can be pushed on its own I think.

Simon


More information about the Gdb-patches mailing list