Markus Armbruster <arm...@redhat.com> writes: > Bandan Das <b...@redhat.com> writes: > >> There's too much going on in monitor_parse_command(). >> Split up the arguments parsing bits into a separate function >> monitor_parse_arguments(). Let the original function check for >> command validity and sub-commands if any and return data (*cmd) >> that the newly introduced function can process and return a >> QDict. Also, pass a pointer to the cmdline to track current >> parser location. >> >> Suggested-by: Markus Armbruster <arm...@redhat.com> >> Signed-off-by: Bandan Das <b...@redhat.com> > > Doesn't apply cleanly anymore. Please double-check my conflict > resolution carefully:
Looks good, Markus. Thank you for taking care of the conflict. Bandan > diff --git a/monitor.c b/monitor.c > index bcb88cd..0b0a8df 100644 > --- a/monitor.c > +++ b/monitor.c > [...] > @@ -4156,13 +4168,17 @@ static void handle_hmp_command(Monitor *mon, const > char *cmdline) > QDict *qdict; > const mon_cmd_t *cmd; > > - qdict = qdict_new(); > + cmd = monitor_parse_command(mon, &cmdline, mon->cmd_table); > + if (!cmd) { > + return; > + } > > - cmd = monitor_parse_command(mon, cmdline, 0, mon->cmd_table, qdict); > - if (cmd) { > - cmd->mhandler.cmd(mon, qdict); > + qdict = monitor_parse_arguments(mon, &cmdline, cmd); > + if (!qdict) { > + return; > } > > + cmd->mhandler.cmd(mon, qdict); > QDECREF(qdict); > } >