Re: [RFC 1/8] Use std::map for MI commands in mi-cmds.c

Jan Vrany
2019-04-25T19:34:48Z

On Thu, 2019-04-25 at 13:15 -0600, Tom Tromey wrote:
> > > > > > "Jan" == Jan Vrany <jan.vrany@fit.cvut.cz> writes:
>
> Oh, I see now, sorry about that:
>
> Jan> + if (mi_cmd_table.fiund (name) != mi_cmd_table.end ())
> Jan> + return false;
>
> This disallows redefining a command, so it seems fine to me.

Actually, you were right! I quickly realized that it is useful
to refedine python MI coomands - mostly during development of
commands itself. So last patch in a series allows that:

@@ -43,7 +43,8 @@ insert_mi_cmd_entry (mi_cmd_up command)
const std::string &name = command->name ();

if (mi_cmd_table.find (name) != mi_cmd_table.end ())
- return false;
+ if (! mi_cmd_table[name]->is_py_command ())
+ return false;

mi_cmd_table[name] = std::move (command);

Thanks!

>
> Tom